제출 #230234

#제출 시각아이디문제언어결과실행 시간메모리
230234syyCarnival (CEOI14_carnival)C++17
0 / 100
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++) #define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--) typedef pair<int, int> pi; #define f first #define s second #define pb push_back #define all(v) v.begin(), v.end() #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) int n, c, col[155], r; vector<int> v; int query(int x, int y, int z = 0) { cout << y-x+1+(z != 0)<< " "; while (x <= y) cout << v[x++] << " "; if (z) cout << z; cout << "\n"; int res; cin >> res; return res; } int main() { fastio; cin >> n; FOR(i, 1, n) { v.pb(i); if (v.size() != query(0, v.size()-1)) v.pop_back(); } c = v.size(); FOR(i, 0, c-1) col[v[i]] = i+1; FOR(i, 1, n) if (!col[i]) { int lower = 0, upper = c-1; while (upper - lower > 1) { int mid = (upper + lower)/2; if (query(lower, mid, i) != mid-lower+2) upper = mid; else lower = mid+1; } cout << "2 " << v[lower] << " " << i << "\n"; cin >> r; if (r == 1) col[i] = col[v[lower]]; else col[i] = col[v[upper]]; } FOR(i, 0, n) cout << col[i] << " "; }

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

carnival.cpp: In function 'int query(int, int, int)':
carnival.cpp:20:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if (z) cout << z; cout << "\n";
  ^~
carnival.cpp:20:20: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  if (z) cout << z; cout << "\n";
                    ^~~~
carnival.cpp: In function 'int main()':
carnival.cpp:29:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (v.size() != query(0, v.size()-1)) v.pop_back();
       ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...