답안 #1005527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005527 2024-06-22T14:55:34 Z vjudge1 Party (POI11_imp) C++17
63 / 100
829 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[3000][3000];
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] << " ";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 2 ms 2904 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2888 KB Output is correct
2 Correct 36 ms 4696 KB Output is correct
3 Correct 24 ms 4728 KB Output is correct
4 Correct 24 ms 4700 KB Output is correct
5 Correct 25 ms 4768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 4188 KB Output is correct
2 Correct 92 ms 13392 KB Output is correct
3 Correct 89 ms 13396 KB Output is correct
4 Correct 96 ms 13376 KB Output is correct
5 Correct 85 ms 13396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 4944 KB Output is correct
2 Correct 245 ms 31584 KB Output is correct
3 Correct 243 ms 31080 KB Output is correct
4 Correct 245 ms 31568 KB Output is correct
5 Correct 239 ms 31572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 11344 KB Output is correct
2 Correct 361 ms 43188 KB Output is correct
3 Correct 357 ms 42580 KB Output is correct
4 Correct 356 ms 42852 KB Output is correct
5 Correct 340 ms 42828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 257 ms 30800 KB Output is correct
2 Correct 464 ms 48676 KB Output is correct
3 Correct 452 ms 48208 KB Output is correct
4 Correct 441 ms 47952 KB Output is correct
5 Correct 424 ms 47956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 379 ms 42836 KB Output is correct
2 Correct 584 ms 58504 KB Output is correct
3 Correct 587 ms 58012 KB Output is correct
4 Correct 582 ms 58108 KB Output is correct
5 Correct 595 ms 58100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 504 ms 51376 KB Output is correct
2 Runtime error 700 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 661 ms 55948 KB Output is correct
2 Runtime error 829 ms 65536 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 748 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 17 ms 20060 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -