Submission #1005431

# Submission time Handle Problem Language Result Execution time Memory
1005431 2024-06-22T12:38:26 Z Almonther Party (POI11_imp) C++
18 / 100
3000 ms 65536 KB
#include <bits/stdc++.h>

#define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define co cout<<
//#pragma GCC optimize("O3,Ofast,unroll-loops")
//#pragma GCC target("avx2,sse3,sse4,avx")
using namespace std;
//stuff
int n,m;
vector<int>v[3005];
bitset<3005>curr,mat[3005],vis;
int cnt=0;
void rec(int x){
    if(cnt==n/3){
        for(int i=0;i<3005;i++){
            if(curr[i]==1) co i<<' ';
        }
        exit(0);
    }
    if(x==n) return;
    if(n-x+cnt<n/3) return ;
    if((curr&mat[x])==curr){
        curr[x]=1;
        cnt++;
        rec(x+1);
        cnt--;
        curr[x]=0;
    }
    rec(x+1);
    return;
}
void rec1(ll x,ll last){
    if(x==n/3){
        for(int i=0;i<3005;i++){
            if(curr[i]==1) co i<<' ';
        }
        exit(0);
    }
    ll num;
    if(last==-1){
        num=rand()%n+1;
        while(vis[num]||(curr&mat[num])!=curr) num=rand()%n+1;
    }
    else{
        num=v[last][rand()%v[last].size()];
        while(vis[num]||(curr&mat[num])!=curr) num=v[last][rand()%v[last].size()];
    }
    vis[num]=1;
    curr[num]=1;
    rec1(x+1,num);
    curr[num]=0;
    vis[num]=0;
}
void solve(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        ll a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
        mat[a][b]=1;
        mat[b][a]=1;
    }
    while(1) rec1(0,-1);
}
int main()
{
    suiii
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
5 Execution timed out 3094 ms 604 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3074 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1624 KB Output is correct
2 Correct 34 ms 5460 KB Output is correct
3 Correct 37 ms 5460 KB Output is correct
4 Correct 35 ms 5468 KB Output is correct
5 Execution timed out 3034 ms 8196 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1884 KB Output is correct
2 Correct 87 ms 12244 KB Output is correct
3 Correct 85 ms 12372 KB Output is correct
4 Correct 84 ms 12372 KB Output is correct
5 Correct 85 ms 12332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 4184 KB Output is correct
2 Correct 135 ms 17232 KB Output is correct
3 Correct 132 ms 27764 KB Output is correct
4 Execution timed out 3080 ms 27732 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 80 ms 12628 KB Output is correct
2 Correct 168 ms 19000 KB Output is correct
3 Execution timed out 3052 ms 18892 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 160 ms 16464 KB Output is correct
2 Correct 221 ms 21840 KB Output is correct
3 Correct 249 ms 39760 KB Output is correct
4 Execution timed out 3070 ms 39772 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 192 ms 18768 KB Output is correct
2 Correct 291 ms 34656 KB Output is correct
3 Correct 262 ms 34640 KB Output is correct
4 Correct 269 ms 34388 KB Output is correct
5 Correct 277 ms 56368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 238 ms 20312 KB Output is correct
2 Execution timed out 3068 ms 37460 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 260 ms 37204 KB Output is correct
2 Execution timed out 3062 ms 41044 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 357 ms 42832 KB Output is correct
2 Correct 406 ms 43244 KB Output is correct
3 Execution timed out 3064 ms 65536 KB Time limit exceeded
4 Halted 0 ms 0 KB -