Submission #1059962

#TimeUsernameProblemLanguageResultExecution timeMemory
1059962Szymon_PilipczukTriangles (CEOI18_tri)C++17
0 / 100
0 ms348 KiB
#include "trilib.h" using namespace std; /*int get_n() { int n; cin>>n; return n; } bool is_clockwise(int a,int b,int c) { cout<<a<<" "<<b<<" "<<c<<"\n"; bool result; cin>>result; return result; } void give_answer(int s) { cout<<s; }*/ int main() { int n = get_n(); int p[n]; p[0] = 1; if(is_clockwise(1,2,3)) { p[1] = 2; p[2] = 3; } else { p[1] = 3; p[2] = 2; } int ans = 3; int l,r; for(int i =4;i<=n;i++) { l = 0; r = ans-1; while(r>(l+2)%n) { int mid = (r+l)/2; if(r = ans-1) { r = 0; } if(is_clockwise(p[l],p[mid],i)) { l = mid; } else { r = mid; } } bool ans2 = is_clockwise(p[l],p[l+1],i); bool ans3 = is_clockwise(p[l+1],p[r],i); return 0; if(ans2 ==false) { if(ans3 == false) { p[l+1] = i; } else { int cu = i; int cu2; for(int j = l+1;j<=ans;+j++) { cu2 = cu; cu = p[j]; p[j] = cu2; } ans++; } } else if(ans3 == false) { int cu = i; int cu2; for(int j = r;j<=ans;j++) { cu2 = cu; cu = p[j]; p[j] = cu2; } ans++; } } give_answer(ans); }

Compilation message (stderr)

tri.cpp: In function 'int main()':
tri.cpp:44:18: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   44 |             if(r = ans-1)
      |                ~~^~~~~~~
tri.cpp:71:40: warning: value computed is not used [-Wunused-value]
   71 |                 for(int j = l+1;j<=ans;+j++)
      |                                        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...