답안 #727457

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
727457 2023-04-20T18:31:10 Z n0sk1ll 사육제 (CEOI14_carnival) C++17
100 / 100
10 ms 336 KB
#include <bits/stdc++.h>
 
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0)
#define mp make_pair
#define xx first
#define yy second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(x) x.begin(),x.end()
#define ff(i,a,b) for (int i = a; i < b; i++)
#define fff(i,a,b) for (int i = a; i <= b; i++)
#define bff(i,a,b) for (int i = b-1; i >= a; i--)
#define bfff(i,a,b) for (int i = b; i >= a; i--)
 
using namespace std;
long double typedef ld;
unsigned int typedef ui;
long long int typedef li;
pair<int,int> typedef pii;
pair<li,li> typedef pli;
pair<ld,ld> typedef pld;
vector<vector<int>> typedef graph;
unsigned long long int typedef ull;
//const int mod = 998244353;
const int mod = 1000000007;
 
 
 
 
 
 
 
//Note to self: Check for overflow
 
int dist[169];
int boja[169];
 
int ask(vector<int> sta)
{
    cout<<(int)sta.size()<<" ";
    for (auto it : sta) cout<<it<<" ";
    cout<<endl;
 
    int x; cin>>x;
    return x;
}
 
int main()
{
    FAST;
 
    int n; cin>>n;
 
    vector<int> tmp;
    fff(i,1,n)
    {
        tmp.pb(i);
        dist[i]=ask(tmp);
    }
 
    vector<int> crucial;
    fff(i,1,n) if (dist[i]!=dist[i-1]) crucial.pb(i),boja[i]=(int)crucial.size();
 
    fff(i,1,n) if (!boja[i])
    {
        int l=0,r=(int)crucial.size()-1;
        while (l!=r)
        {
            int mid=(l+r)/2;
            vector<int> sta;
            sta.pb(i);
            fff(j,l,mid) sta.pb(crucial[j]);
            if (ask(sta)==(int)sta.size()) l=mid+1;
            else r=mid;
        }
        boja[i]=l+1;
    }
 
    cout<<0<<" ";
    fff(i,1,n) cout<<boja[i]<<" "; cout<<endl;
}
 
//Note to self: Check for overflow

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:13:20: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   13 | #define fff(i,a,b) for (int i = a; i <= b; i++)
      |                    ^~~
carnival.cpp:82:5: note: in expansion of macro 'fff'
   82 |     fff(i,1,n) cout<<boja[i]<<" "; cout<<endl;
      |     ^~~
carnival.cpp:82:36: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   82 |     fff(i,1,n) cout<<boja[i]<<" "; cout<<endl;
      |                                    ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 324 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 5 ms 220 KB Output is correct
4 Correct 3 ms 328 KB Output is correct
5 Correct 5 ms 320 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 320 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 4 ms 208 KB Output is correct
4 Correct 3 ms 324 KB Output is correct
5 Correct 8 ms 208 KB Output is correct
6 Correct 6 ms 316 KB Output is correct
7 Correct 8 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 328 KB Output is correct
2 Correct 4 ms 328 KB Output is correct
3 Correct 9 ms 332 KB Output is correct
4 Correct 4 ms 320 KB Output is correct
5 Correct 6 ms 208 KB Output is correct
6 Correct 8 ms 320 KB Output is correct
7 Correct 8 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 3 ms 324 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 8 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 4 ms 320 KB Output is correct
4 Correct 5 ms 324 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 3 ms 336 KB Output is correct