제출 #83827

#제출 시각아이디문제언어결과실행 시간메모리
83827aminra사육제 (CEOI14_carnival)C++14
100 / 100
10 ms696 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double ld; const int MAXN = (int)1e5 + 7; const int infint = (int)1e9; const int MOD = (int)1e9 + 9; const ll inf = (ll)2e18 + 2; int n, a[MAXN], tsz = 1; int ask(vector<int> v) { cout << v.size() << " "; for (auto u : v) cout << u << " "; cout << endl; int get; cin >> get; return get; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; a[1] = tsz; vector<int> nws; nws.push_back(1); for (int i = 2; i <= n; i++) { nws.push_back(i); int t = ask(nws); if(t == nws.size()) { a[i] = ++tsz; continue; } else { nws.pop_back(); int L = -1, R = nws.size() - 1; while(R - L > 1) { int mid = (R + L) >> 1; vector<int> tmp; for (int i = 0; i <= mid; i++) tmp.push_back(nws[i]); tmp.push_back(i); int t = ask(tmp); if(t == tmp.size() - 1) R = mid; else L = mid; } a[i] = a[nws[R]]; } } cout << 0 << " "; for (int i = 1; i <= n; i++) cout << a[i] << " "; cout << endl; }

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

carnival.cpp: In function 'int main()':
carnival.cpp:32:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(t == nws.size())
      ~~^~~~~~~~~~~~~
carnival.cpp:49:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(t == tmp.size() - 1)
        ~~^~~~~~~~~~~~~~~~~
#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...