제출 #986834

#제출 시각아이디문제언어결과실행 시간메모리
986834Tsagana콤보 (IOI18_combo)C++14
10 / 100
37 ms596 KiB
#include "combo.h" #include<bits/stdc++.h> #define all(x) x.begin(), x.end() #define pq priority_queue #define lb lower_bound #define ub upper_bound #define pb push_back #define eb emplace_back #define F first #define S second using namespace std; char ch(char c) { if (c == 'A') return 'B'; if (c == 'B') return 'X'; if (c == 'X') return 'Y'; if (c == 'Y') return 'A'; } string guess_sequence(int N) { string p = ""; string s = ""; int leng = 0; int coin = 0; char c = 'A'; char fc; while (leng < N) { p = s; for (int i = leng; i < N*2; i++) p += c; coin = press(p); if (!leng && coin) fc = c; if (coin > leng) for (; leng < min(coin, N); leng++) s += c; else c = ch(c); if (c == fc) c = ch(c); } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:5: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   35 |     else c = ch(c); if (c == fc) c = ch(c);
      |     ^~~~
combo.cpp:35:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   35 |     else c = ch(c); if (c == fc) c = ch(c);
      |                     ^~
combo.cpp: In function 'char ch(char)':
combo.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
   20 | }
      | ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:21: warning: 'fc' may be used uninitialized in this function [-Wmaybe-uninitialized]
   35 |     else c = ch(c); if (c == fc) c = ch(c);
      |                     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...