Submission #153869

#TimeUsernameProblemLanguageResultExecution timeMemory
153869dennisstar철로 (IOI14_rail)C++11
0 / 100
85 ms652 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; int ar1[5010], ar2[5010], ar3[5010]; int x, y; int dy, my; void findLocation(int N, int first, int location[], int stype[]) { if (N==1) { location[0]=first; stype[0]=1; return ; } if (N==2) { int n=getDistance(0, 1); location[0]=first; stype[0]=1; location[1]=first+n; stype[1]=2; } int i; for (i=0; i<N; i++) {if (i!=0) ar1[i]=getDistance(0, i);} int mn=(1<<30); for (i=1; i<N; i++) mn=min(ar1[i], mn); for (i=1; i<N; i++) if (mn==ar1[i]) break; x=i; for (i=0; i<N; i++) {if (i!=x) ar2[i]=getDistance(x, i);} int mx=0; for (i=0; i<N; i++) mx=max(min(ar1[i], ar2[i]), mx); for (i=0; i<N; i++) if (mx==min(ar1[i], ar2[i])) break; y=i; for (i=0; i<N; i++) {if (!i!=y) ar3[i]=getDistance(y, i);} dy=(1<<30); for (i=0; i<N; i++) if (i!=y) dy=min(dy, ar3[i]); for (i=0; i<N; i++) if (dy==ar3[i]) {my=i; break;} if (ar1[x]+ar2[y]==ar3[x]) {} else if (dy+ar2[my]+ar1[x]==ar1[y]) {} else if (ar1[x]+ar1[y]==ar2[y]) {} else if (ar1[x]+ar1[y]==dy+ar2[my]) {} else { assert(false); } }

Compilation message (stderr)

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:29:29: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
  for (i=0; i<N; i++) {if (!i!=y) ar3[i]=getDistance(y, i);}
                             ^~
rail.cpp:29:27: note: add parentheses around left hand side expression to silence this warning
  for (i=0; i<N; i++) {if (!i!=y) ar3[i]=getDistance(y, i);}
                           ^~
                           ( )
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...