Submission #1005525

# Submission time Handle Problem Language Result Execution time Memory
1005525 2024-06-22T14:52:35 Z vjudge1 Party (POI11_imp) C++17
27 / 100
1284 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;
map<pair<int, int>, bool>f;
signed main(){
    int n, m;
    cin >> n >> m;
    e.resize(n+1);
    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]){
                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 1 ms 604 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 4 ms 860 KB Output is correct
4 Correct 4 ms 856 KB Output is correct
5 Correct 4 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 2392 KB Output is correct
2 Correct 188 ms 14932 KB Output is correct
3 Correct 194 ms 15032 KB Output is correct
4 Correct 179 ms 14928 KB Output is correct
5 Correct 185 ms 14864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 87 ms 9040 KB Output is correct
2 Correct 1255 ms 58860 KB Output is correct
3 Correct 1207 ms 58704 KB Output is correct
4 Correct 1284 ms 58700 KB Output is correct
5 Correct 1243 ms 58684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 263 ms 18688 KB Output is correct
2 Runtime error 630 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 740 ms 43348 KB Output is correct
2 Runtime error 581 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 580 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 632 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 677 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 613 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 553 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 619 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -