Submission #910523
Source Code Expand
Copy
//usr/bin/env go run $0 $@;exitpackage mainimport("fmt""runtime")var x [2000]intvar y [2000]intvar tbl [2000][2000]intfunc S(n int) int{return n*n}func main(){var N intfmt.Scanf("%d",&N)ch0 := make(chan int)ch1 := make(chan int)ch2 := make(chan int)for i:=0;i<N;i++ {fmt.Scanf("%d%d",&x[i],&y[i])}for i:=0;i<N;i++ {for j:=0;j<i;j++ {tbl[i][j]=S(x[i]-x[j])+S(y[i]-y[j])}}threads:=1
//usr/bin/env go run $0 $@;exit package main import( "fmt" "runtime" ) var x [2000]int var y [2000]int var tbl [2000][2000]int func S(n int) int{return n*n} func main(){ var N int fmt.Scanf("%d",&N) ch0 := make(chan int) ch1 := make(chan int) ch2 := make(chan int) for i:=0;i<N;i++ {fmt.Scanf("%d%d",&x[i],&y[i])} for i:=0;i<N;i++ {for j:=0;j<i;j++ {tbl[i][j]=S(x[i]-x[j])+S(y[i]-y[j])}} threads:=1 runtime.GOMAXPROCS(threads) // not required in Go 1.5+ f:=func(start int){ r0:=0 r1:=0 r2:=0 for i:=start;i<N;i+=threads {for j:=0;j<i;j++ {for k:=0;k<j;k++ { a:=tbl[i][j] b:=tbl[j][k] c:=tbl[i][k] m:=a if m<b {m=b} if m<c {m=c} m=a+b+c-m-m if m>0 { r0++ }else if m==0 { r1++ }else if m<0 { r2++ } }}} ch0<-r0 ch1<-r1 ch2<-r2 } for start:=0;start<threads;start++ { go f(start) } //f(0) // avoid context switch //!? r0:=0 r1:=0 r2:=0 for start:=0;start<threads;start++ { r0+=<-ch0 r1+=<-ch1 r2+=<-ch2 } fmt.Printf("%d %d %d\n",r0,r1,r2); }
Submission Info
Submission Time | |
---|---|
Task | D - 三角形の分類 |
User | leafmoon |
Language | Go (1.4.1) |
Score | 30 |
Code Size | 1093 Byte |
Status | TLE |
Exec Time | 7032 ms |
Memory | 23804 KB |
Judge Result
Set Name | sample | subtask01 | subtask02 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 30 / 30 | 0 / 70 | ||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
subtask01 | 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-handmade00.txt, 01-handmade01.txt, 01-handmade02.txt, 01-handmade03.txt, 01-handmade04.txt, 01-handmade05.txt, sample-01.txt, sample-02.txt |
subtask02 | 01-00.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-handmade00.txt, 01-handmade01.txt, 01-handmade02.txt, 01-handmade03.txt, 01-handmade04.txt, 01-handmade05.txt, 02-00.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt, 02-14.txt, 02-15.txt, 02-16.txt, 02-17.txt, 02-18.txt, 02-19.txt, 02-handmade00.txt, 02-handmade01.txt, 02-handmade02.txt, 02-handmade03.txt, 02-handmade04.txt, 02-handmade05.txt, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-00.txt | AC | 17 ms | 928 KB |
01-01.txt | AC | 17 ms | 920 KB |
01-02.txt | AC | 16 ms | 928 KB |
01-03.txt | AC | 18 ms | 1056 KB |
01-04.txt | AC | 18 ms | 1176 KB |
01-05.txt | AC | 17 ms | 1184 KB |
01-06.txt | AC | 17 ms | 1180 KB |
01-07.txt | AC | 20 ms | 1436 KB |
01-08.txt | AC | 24 ms | 1436 KB |
01-09.txt | AC | 20 ms | 1440 KB |
01-10.txt | AC | 22 ms | 1436 KB |
01-11.txt | AC | 20 ms | 1436 KB |
01-12.txt | AC | 21 ms | 1440 KB |
01-13.txt | AC | 22 ms | 1436 KB |
01-14.txt | AC | 22 ms | 1440 KB |
01-15.txt | AC | 22 ms | 1436 KB |
01-16.txt | AC | 25 ms | 1432 KB |
01-17.txt | AC | 22 ms | 1436 KB |
01-18.txt | AC | 20 ms | 1440 KB |
01-19.txt | AC | 22 ms | 1440 KB |
01-handmade00.txt | AC | 18 ms | 1180 KB |
01-handmade01.txt | AC | 20 ms | 1440 KB |
01-handmade02.txt | AC | 18 ms | 1312 KB |
01-handmade03.txt | AC | 22 ms | 1436 KB |
01-handmade04.txt | AC | 22 ms | 1424 KB |
01-handmade05.txt | AC | 22 ms | 1436 KB |
02-00.txt | AC | 38 ms | 2080 KB |
02-01.txt | AC | 151 ms | 3240 KB |
02-02.txt | AC | 154 ms | 3232 KB |
02-03.txt | AC | 709 ms | 5668 KB |
02-04.txt | AC | 711 ms | 5740 KB |
02-05.txt | AC | 709 ms | 5628 KB |
02-06.txt | AC | 1994 ms | 8868 KB |
02-07.txt | AC | 1999 ms | 8828 KB |
02-08.txt | AC | 2007 ms | 8828 KB |
02-09.txt | AC | 2000 ms | 8828 KB |
02-10.txt | AC | 1997 ms | 8872 KB |
02-11.txt | AC | 1999 ms | 8876 KB |
02-12.txt | AC | 2008 ms | 8948 KB |
02-13.txt | TLE | 7032 ms | 23792 KB |
02-14.txt | TLE | 7028 ms | 23804 KB |
02-15.txt | TLE | 7029 ms | 23796 KB |
02-16.txt | TLE | 7030 ms | 23680 KB |
02-17.txt | TLE | 7030 ms | 23724 KB |
02-18.txt | TLE | 7028 ms | 23724 KB |
02-19.txt | TLE | 7028 ms | 23676 KB |
02-handmade00.txt | AC | 5216 ms | 13940 KB |
02-handmade01.txt | TLE | 7030 ms | 23720 KB |
02-handmade02.txt | AC | 6695 ms | 15784 KB |
02-handmade03.txt | TLE | 7030 ms | 23656 KB |
02-handmade04.txt | TLE | 7028 ms | 23716 KB |
02-handmade05.txt | TLE | 7030 ms | 23716 KB |
sample-01.txt | AC | 17 ms | 928 KB |
sample-02.txt | AC | 16 ms | 1052 KB |