제출 #1060045

#제출 시각아이디문제언어결과실행 시간메모리
1060045Szymon_PilipczukTriangles (CEOI18_tri)C++17
0 / 100
1 ms348 KiB
#include "trilib.h" //#include <iostream> 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"; int result; cin>>result; if(result ==0) { return false; } else { return true; } } 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); if(ans = 3) { if (ans2 == false &&ans3 == false) { p[l+1] = i; } else if (ans2&&ans3) { p[r+1] = i; ans++; } else { bool ans4 = is_clockwise(p[l],p[r],i); if(ans4) { if(ans2) { p[r] = i; } else { p[l] = i; } } else { if(ans2) { int cu = i; int cu2; for(int j = r;j<=ans;j++) { cu2 = cu; cu = p[j]; p[j] = cu2; } ans++; } 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(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); }

컴파일 시 표준 에러 (stderr) 메시지

tri.cpp: In function 'int main()':
tri.cpp:68:16: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   68 |         if(ans = 3)
      |            ~~~~^~~
#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...