Submission #1005529

# Submission time Handle Problem Language Result Execution time Memory
1005529 2024-06-22T14:56:37 Z vjudge1 Party (POI11_imp) C++17
63 / 100
824 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;
bool f[3002][3002];
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[j][x] = 0;
                        f[x][j] = 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 348 KB Output is correct
2 Correct 0 ms 372 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2904 KB Output is correct
2 Correct 24 ms 4700 KB Output is correct
3 Correct 24 ms 4696 KB Output is correct
4 Correct 24 ms 4868 KB Output is correct
5 Correct 24 ms 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 4172 KB Output is correct
2 Correct 104 ms 13392 KB Output is correct
3 Correct 98 ms 13392 KB Output is correct
4 Correct 99 ms 13648 KB Output is correct
5 Correct 96 ms 13392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 4992 KB Output is correct
2 Correct 247 ms 27492 KB Output is correct
3 Correct 230 ms 27476 KB Output is correct
4 Correct 241 ms 27472 KB Output is correct
5 Correct 228 ms 27476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 11348 KB Output is correct
2 Correct 331 ms 37348 KB Output is correct
3 Correct 330 ms 37228 KB Output is correct
4 Correct 341 ms 37200 KB Output is correct
5 Correct 326 ms 37080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 212 ms 27220 KB Output is correct
2 Correct 446 ms 41272 KB Output is correct
3 Correct 496 ms 41440 KB Output is correct
4 Correct 824 ms 41040 KB Output is correct
5 Correct 426 ms 41044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 372 ms 36180 KB Output is correct
2 Correct 527 ms 49168 KB Output is correct
3 Correct 544 ms 48980 KB Output is correct
4 Correct 515 ms 48912 KB Output is correct
5 Correct 554 ms 49000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 489 ms 43120 KB Output is correct
2 Runtime error 694 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 556 ms 45964 KB Output is correct
2 Runtime error 680 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 670 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 734 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -