답안 #533267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533267 2022-03-05T08:17:36 Z andecaandeci 사육제 (CEOI14_carnival) C++17
100 / 100
10 ms 312 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef double dbl;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef map<ll, ll> mll;
typedef pair<string, ll> psl;
typedef map<string, ll> msl;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef deque<ll> deq;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqm;
typedef priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> dij;
typedef priority_queue<ll> pq;
typedef string str;
const ll mod=1e9+7;
const ll maxn=1e5+1;
ll gcd(ll a, ll b) {
    return a==0 ? b : gcd(a, b%a);
}
ll lcm(ll a, ll b) {
    ll ans=a*b;
    ans=ans/(gcd(a, b));
    return ans;
}
#define ihacoy ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define dh << endl;
#define co cout <<
#define udh cout << endl;
#define spa << " ";
#define ci cin >>
#define fi first
#define se second
#define sp << " " <<
#define tes while(t--)
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()
#define gre greater<ll>()
#define sip return 0
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
int n;
int main() {
    ihacoy
    ci n;
    vi beda, sama;
    int warna[155];
    for(int i=1; i<=n; i++) {
        co beda.size()+1;
        for(int j=0; j<beda.size(); j++) {
            co " " << beda[j];
        }
        co " " << i dh
        udh
        int jawab; ci jawab;
        if(jawab==beda.size()+1) beda.pb(i);
        else sama.pb(i);
    }
    for(int i=0; i<beda.size(); i++) warna[beda[i]]=i+1;
    for(int i=0; i<sama.size(); i++) {
        int l=0, r=(int)beda.size(), now=sama[i], ans=-1;
        while(l<=r) {
            int md=(l+r)/2;
            co md+2;
            co " " << now;
            for(int j=0; j<=md; j++) {
                co " " << beda[j];
            }
            udh
            int jawab; ci jawab;
            int byk=md+1;
            if(jawab==byk) {
                ans=md;
                r=md-1;
            } else l=md+1;
        }
        warna[now]=ans+1;
    }
    co 0;
    for(int i=1; i<=n; i++) co " " << warna[i];
    udh
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:55:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         for(int j=0; j<beda.size(); j++) {
      |                      ~^~~~~~~~~~~~
carnival.cpp:61:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |         if(jawab==beda.size()+1) beda.pb(i);
      |            ~~~~~^~~~~~~~~~~~~~~
carnival.cpp:64:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |     for(int i=0; i<beda.size(); i++) warna[beda[i]]=i+1;
      |                  ~^~~~~~~~~~~~
carnival.cpp:65:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for(int i=0; i<sama.size(); i++) {
      |                  ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 8 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
5 Correct 5 ms 200 KB Output is correct
6 Correct 3 ms 304 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Output is correct
2 Correct 10 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 8 ms 308 KB Output is correct
6 Correct 4 ms 308 KB Output is correct
7 Correct 7 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 10 ms 308 KB Output is correct
3 Correct 8 ms 200 KB Output is correct
4 Correct 5 ms 312 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 7 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 304 KB Output is correct
2 Correct 5 ms 304 KB Output is correct
3 Correct 4 ms 200 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
5 Correct 4 ms 200 KB Output is correct
6 Correct 5 ms 308 KB Output is correct
7 Correct 6 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Output is correct
2 Correct 8 ms 308 KB Output is correct
3 Correct 8 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 6 ms 308 KB Output is correct
6 Correct 5 ms 200 KB Output is correct
7 Correct 5 ms 308 KB Output is correct