제출 #535420

#제출 시각아이디문제언어결과실행 시간메모리
535420mario05092929콤보 (IOI18_combo)C++14
100 / 100
74 ms592 KiB
#include "combo.h" #include <bits/stdc++.h> #define x first #define y second using namespace std; typedef long long ll; typedef long double ld; typedef pair <ll,ll> pl; typedef pair <int,int> pi; typedef vector <int> vec; const ll INF = 1e18; char pr[4]; string ans; int n,g; string guess_sequence(int N) { n = N; string p; p = "AB"; int cmp = press(p); if(cmp) { p = "A"; cmp = press(p); if(cmp) pr[3] = 'A'; else pr[3] = 'B'; } else { p = "X"; cmp = press(p); if(cmp) pr[3] = 'X'; else pr[3] = 'Y'; } ans += pr[3]; if(n == 1) return ans; if(pr[3] != 'A') pr[g++] = 'A'; if(pr[3] != 'B') pr[g++] = 'B'; if(pr[3] != 'X') pr[g++] = 'X'; if(pr[3] != 'Y') pr[g++] = 'Y'; int i = 1; for(;i < n-1;i++) { p.clear(); for(int j = 0;j < 3;j++) { for(int k = 0;k < i;k++) p += ans[k]; p += pr[0]; p += pr[j]; } for(int k = 0;k < i;k++) p += ans[k]; p += pr[1]; cmp = press(p); if(cmp == i) ans += pr[2]; else if(cmp == i+1) ans += pr[1]; else ans += pr[0]; } p.clear(); for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[0]; for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[1]; cmp = press(p); if(cmp == n) { p.clear(); for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[0]; cmp = press(p); if(cmp == n) ans += pr[0]; else ans += pr[1]; } else ans += pr[2]; return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:55:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   55 |     for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[0];
      |     ^~~
combo.cpp:55:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   55 |     for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[0];
      |                                             ^
combo.cpp:56:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   56 |     for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[1];
      |     ^~~
combo.cpp:56:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   56 |     for(int j = 0;j < n-1;j++) p += ans[j]; p += pr[1];
      |                                             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...