Submission #486556

# Submission time Handle Problem Language Result Execution time Memory
486556 2021-11-12T01:47:46 Z julian33 Party (POI11_imp) C++14
100 / 100
840 ms 65536 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
    cerr<<vars<<" = ";
    string delim="";
    (...,(cerr<<delim<<values,delim=", "));
    cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif

#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);} 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mxN=3e3+5; //make sure this is right
const int mod=1e9+7;

int good[mxN][mxN];

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    vector<vector<int>> has;
    int n,m; cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b; cin>>a>>b;
        good[a][b]=good[b][a]=1;
    }
    for(int i=1;i<=n;i++){
        int found=0;
        for(auto &u:has){
            int bad=0;
            for(int &j:u){
                if(!good[i][j]) bad=1;
            }
            if(bad) continue;
            found=1;
            u.pb(i);
            break;
        }
        if(!found) has.pb({i});
    }
    for(auto &u:has){
        if(sz(u)>=n/3){
            for(int i=0;i<n/3;i++){
                cout<<u[i]<<" ";
            }
            return 0;
        }
    }
    assert(false);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 716 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1228 KB Output is correct
2 Correct 12 ms 3916 KB Output is correct
3 Correct 12 ms 3904 KB Output is correct
4 Correct 13 ms 3924 KB Output is correct
5 Correct 13 ms 3916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 2508 KB Output is correct
2 Correct 51 ms 11104 KB Output is correct
3 Correct 63 ms 11116 KB Output is correct
4 Correct 59 ms 11108 KB Output is correct
5 Correct 57 ms 11116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 4044 KB Output is correct
2 Correct 165 ms 22284 KB Output is correct
3 Correct 156 ms 22096 KB Output is correct
4 Correct 157 ms 22280 KB Output is correct
5 Correct 209 ms 22368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 6988 KB Output is correct
2 Correct 285 ms 31008 KB Output is correct
3 Correct 260 ms 30724 KB Output is correct
4 Correct 266 ms 30868 KB Output is correct
5 Correct 270 ms 30940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 136 ms 15044 KB Output is correct
2 Correct 341 ms 37212 KB Output is correct
3 Correct 347 ms 37008 KB Output is correct
4 Correct 368 ms 37276 KB Output is correct
5 Correct 379 ms 37128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 305 ms 23748 KB Output is correct
2 Correct 451 ms 45596 KB Output is correct
3 Correct 467 ms 45212 KB Output is correct
4 Correct 465 ms 45344 KB Output is correct
5 Correct 493 ms 45380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 402 ms 27340 KB Output is correct
2 Correct 538 ms 51432 KB Output is correct
3 Correct 546 ms 50992 KB Output is correct
4 Correct 553 ms 51228 KB Output is correct
5 Correct 632 ms 51172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 511 ms 29708 KB Output is correct
2 Correct 656 ms 57828 KB Output is correct
3 Correct 648 ms 57348 KB Output is correct
4 Correct 673 ms 57476 KB Output is correct
5 Correct 664 ms 57436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 573 ms 32080 KB Output is correct
2 Correct 757 ms 63976 KB Output is correct
3 Correct 797 ms 63744 KB Output is correct
4 Correct 838 ms 63784 KB Output is correct
5 Correct 774 ms 63676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 713 ms 35664 KB Output is correct
2 Correct 811 ms 65536 KB Output is correct
3 Correct 840 ms 65536 KB Output is correct
4 Correct 840 ms 65536 KB Output is correct
5 Correct 831 ms 65536 KB Output is correct