답안 #590670

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590670 2022-07-06T08:32:05 Z Mounir 사육제 (CEOI14_carnival) C++14
100 / 100
9 ms 336 KB
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;

signed main(){ 
      ios::sync_with_stdio(false);
      cin.tie(nullptr);
      cout.tie(nullptr);

      int nAmis; cin >> nAmis;
      vector<int> costumes(nAmis + 1, -1);
      vector<int> distincts = {1};
      costumes[1] = 1;
      for (int iAmi = 2; iAmi <= nAmis; ++iAmi){
            cout << sz(distincts) + 1 << endl;
            for (int distinct : distincts)
                  cout << distinct << " ";
            cout << iAmi << endl;
            int nDiff; cin >> nDiff;
            if (nDiff != sz(distincts)){
                  costumes[iAmi] = sz(distincts) + 1;
                  distincts.pb(iAmi);
            }
            else {
                  int deb = 0, fin = sz(distincts) - 1;
                  while (fin > deb){
                        int mid = (deb + fin)/2;
                        vector<int> tests = {iAmi};
                        for (int i = deb; i <= mid; ++i)
                              tests.pb(distincts[i]);
                        cout << sz(tests) << endl;
                        for (int test : tests)  
                              cout << test << " ";
                        cout << endl;
                        cin >> nDiff;
                        if (nDiff != sz(tests))
                              fin = mid;
                        else  
                              deb = mid + 1;
                  }
                  costumes[iAmi] = costumes[distincts[deb]];
            }
      }

      cout << 0 << " ";
      for (int i = 1; i <= nAmis; ++i)
            cout << costumes[i] << " ";
      cout << endl;
      return 0;   
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 312 KB Output is correct
2 Correct 8 ms 336 KB Output is correct
3 Correct 5 ms 312 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 2 ms 208 KB Output is correct
7 Correct 5 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 6 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 208 KB Output is correct
2 Correct 4 ms 312 KB Output is correct
3 Correct 9 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 7 ms 316 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 5 ms 208 KB Output is correct
3 Correct 4 ms 320 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 7 ms 316 KB Output is correct
6 Correct 5 ms 316 KB Output is correct
7 Correct 9 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 3 ms 316 KB Output is correct
5 Correct 4 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 3 ms 208 KB Output is correct