Submission #1005509

# Submission time Handle Problem Language Result Execution time Memory
1005509 2024-06-22T14:02:09 Z vjudge1 Party (POI11_imp) C++17
27 / 100
1222 ms 65536 KB
#include <bits/stdc++.h>
//#include "Allincludes.h"
typedef long long ll;
using namespace std;
#define int long long
vector<vector<int>>e;
signed main(){
    int n, m;
    cin >> n >> m;
    e.resize(n+1);
    map<pair<int, int>, bool>f;
    while(m--){
        int a, b;
        cin >> a >> b;
        e[a].push_back(b);
        e[b].push_back(a);
        f[{a, b}] = 1;
        f[{b, a}] = 1;
    }
    bool ii[n+1];
    fill(ii, ii+n+1, 0);
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            if(!ii[i] && !ii[j]){
//                cout << i << " " << j << " " << f[{i, j}]<<endl;
                if(i != j && f[{i, j}] == 0){
                    ii[i] = 1;
                    ii[j] = 1;
                    for(auto x : e[i]){
                        f[{i, x}] = 0;
                        f[{x, i}] = 0;
                    }
                    for(auto x : e[j]){
                        f[{x, j}] = 0;
                        f[{j, x}] = 0;
                    }
                }
            }
        }
    }
    vector<int>ans;
    for(int i = 1; i <= n; i++){
        for(auto x : e[i]){
            if(f[{i, x}]){
                ans.push_back(i);
                break;
            }
            if(f[{x, i}]){
                ans.push_back(i);
                break;
            }
        }
    }
    int y = n/3;
    for(int i = 0; i < y; i++){
        cout << ans[i] << " ";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 4 ms 856 KB Output is correct
4 Correct 4 ms 860 KB Output is correct
5 Correct 4 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 2476 KB Output is correct
2 Correct 166 ms 14408 KB Output is correct
3 Correct 183 ms 14480 KB Output is correct
4 Correct 173 ms 14416 KB Output is correct
5 Correct 192 ms 14420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 8532 KB Output is correct
2 Correct 1093 ms 56916 KB Output is correct
3 Correct 1218 ms 57176 KB Output is correct
4 Correct 1150 ms 56868 KB Output is correct
5 Correct 1222 ms 56916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 219 ms 18260 KB Output is correct
2 Runtime error 603 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 677 ms 41556 KB Output is correct
2 Runtime error 604 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 574 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 603 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 650 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 550 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 630 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 530 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -