답안 #245705

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245705 2020-07-07T08:16:19 Z hollwo_pelw 사육제 (CEOI14_carnival) C++17
100 / 100
26 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
// type
typedef long long ll;
typedef long double ld;
// loop
//#define For(i, l, r, x)     for (int i = l; i < r; i+=x)
//#define ForE(i, l, r, x)    for (int i = l; i <= r; i+=x)
//#define Ford(i, r, l)       for (int i = r; i > l; i--)
//#define FordE(i, r, l)      for (int i = r; i >= l; i--)
//#define Fora(i, a)          for (auto i : a)
// I/O 
#define FAST_IO             std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//#define PrintV(a)           Fora(ii, a) cout << ii << ' '; cout << rl;
//#define PrintVl(a)          Fora(ii, a) cout << ii << rl;
//#define PrintA(a, l, r)     for (int ii = l; ii <= r; ii++) cout << a[ii] << ' '; cout << rl;
//#define PrintAl(a, l, r)    for (int ii = l; ii <= r; ii++) cout << a[ii] << rl;
//#define Ptest(x)            return cout << x, 0;
#define setpre(n)           fixed << setprecision(n)
// pair
#define F                   first
#define S                   second
#define pii                 pair<int, int>
#define pll                 pair<ll, ll>
#define pdd                 pair<ld, ld>
// vector & !!?(string)
#define eb                  emplace_back
#define pb                  push_back
#define all(a)              a.begin(), a.end()
#define rall(a)             a.rbegin(), a.rend()
#define sz(a)               (int) a.size()
//#define len(a)              a.length()
// geometry calc    
#define pi                  acos(-1.0)
#define g_sin(a)            sin(a*pi/180)
#define g_cos(a)            cos(a*pi/180)
#define g_tan(a)            tan(a*pi/180)
// set val
#define ms0(a)              memset(a,        0, sizeof(a));
#define ms1(a)              memset(a,        1, sizeof(a));
#define msn1(a)             memset(a,       -1, sizeof(a));
#define msinf(a)            memset(a, 0x3f3f3f, sizeof(a));
// constant
const int mod1 = 998244353, mod = 1e9+7;
const int MAXN = 100005, MAX_M = 200010;
// code
#define int long long
 
int n;
int ans[200], col[200];
int query(int i, int t = -1){
    cout << i + (t > 0) << ' ';
    for (int j = 1; j <= i; j++)
        cout << j << ' ';
  	if (t > 0) cout << t << ' ';
    cout << endl;
    int x; cin >> x;
    return x;
}
 
void Solve(){
    cin >> n;
    ans[1] = col[1] = 1;
    int cnt = 1;
    for (int i = 2; i <= n; i++){
        int x = query(i);
        if (x > cnt){
            col[i] = col[i-1] + 1;
            ans[i] = ++cnt;
        }else{
            col[i] = col[i-1];
            int l = 1, r = i-1;
            while (l < r){
                int mid = (l+r)/2;
                int g = query(mid, i);
                if (g == col[mid])
                    r = mid;
                else 
                    l = mid + 1;
            }
            ans[i] = ans[l];
        }
    }
    cout << "0 ";
    for (int i = 1; i <= n; i++)
        cout << ans[i] << ' ';
}
 
signed main(){
    FAST_IO;
    int TC = 1; 
	//cin >> TC;
    while(TC--) Solve();
    return 0;
}

Compilation message

carnival.cpp: In function 'long long int query(long long int, long long int)':
carnival.cpp:53:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int j = 1; j <= i; j++)
     ^~~
carnival.cpp:55:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    if (t > 0) cout << t << ' ';
    ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 11 ms 512 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 13 ms 384 KB Output is correct
6 Correct 18 ms 312 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 384 KB Output is correct
2 Correct 17 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 9 ms 384 KB Output is correct
5 Correct 14 ms 384 KB Output is correct
6 Correct 16 ms 384 KB Output is correct
7 Correct 14 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 384 KB Output is correct
2 Correct 18 ms 384 KB Output is correct
3 Correct 13 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 18 ms 384 KB Output is correct
6 Correct 17 ms 384 KB Output is correct
7 Correct 14 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 12 ms 384 KB Output is correct
3 Correct 9 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 15 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 384 KB Output is correct
2 Correct 11 ms 384 KB Output is correct
3 Correct 14 ms 384 KB Output is correct
4 Correct 13 ms 384 KB Output is correct
5 Correct 13 ms 384 KB Output is correct
6 Correct 11 ms 384 KB Output is correct
7 Correct 8 ms 384 KB Output is correct