Submission #363454

# Submission time Handle Problem Language Result Execution time Memory
363454 2021-02-06T04:53:44 Z tranxuanbach Party (POI11_imp) C++17
100 / 100
874 ms 41356 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define endl '\n'
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define FordE(i, l, r) for (int i = l; i >= r; i--)
#define Fora(v, a) for (auto v: a)
#define bend(a) a.begin(), a.end()
#define isz(a) ((signed)a.size())

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <pii> vpii;
typedef vector <vi> vvi;

const int N = 3e3 + 5;

int n, m;
bool adj[N][N];
bool ck[N];

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    // freopen(".inp", "r", stdin);
    // freopen(".out", "w", stdout);
    cin >> n >> m;
    ForE(i, 1, m){
        int u, v; cin >> u >> v;
        adj[u][v] = 1;
    }
    ForE(i, 1, n){
        ForE(j, i + 1, n){
            if (!adj[i][j] && !ck[i] && !ck[j]){
                ck[i] = ck[j] = 1;
            }
        }
    }
    vi vans;
    ForE(i, 1, n){
        if (!ck[i]){
            vans.push_back(i);
            if (isz(vans) == n / 3){
                break;
            }
        }
    }
    Fora(&v, vans){
        cout << v << ' ';
    } cout << endl;
}

/*
==================================================+
INPUT:                                            |
--------------------------------------------------|

--------------------------------------------------|
==================================================+
OUTPUT:                                           |
--------------------------------------------------|

--------------------------------------------------|
==================================================+
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 1 ms 620 KB Output is correct
4 Correct 1 ms 620 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1004 KB Output is correct
2 Correct 16 ms 2540 KB Output is correct
3 Correct 18 ms 2540 KB Output is correct
4 Correct 16 ms 2540 KB Output is correct
5 Correct 17 ms 2540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 1900 KB Output is correct
2 Correct 69 ms 6252 KB Output is correct
3 Correct 71 ms 6252 KB Output is correct
4 Correct 65 ms 6252 KB Output is correct
5 Correct 74 ms 6248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 3052 KB Output is correct
2 Correct 165 ms 12140 KB Output is correct
3 Correct 177 ms 12012 KB Output is correct
4 Correct 186 ms 12012 KB Output is correct
5 Correct 168 ms 12012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 5100 KB Output is correct
2 Correct 254 ms 16492 KB Output is correct
3 Correct 251 ms 16364 KB Output is correct
4 Correct 246 ms 16748 KB Output is correct
5 Correct 239 ms 16572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 148 ms 11372 KB Output is correct
2 Correct 335 ms 19788 KB Output is correct
3 Correct 388 ms 19588 KB Output is correct
4 Correct 310 ms 19948 KB Output is correct
5 Correct 314 ms 19948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 303 ms 18452 KB Output is correct
2 Correct 427 ms 25580 KB Output is correct
3 Correct 444 ms 25324 KB Output is correct
4 Correct 472 ms 25196 KB Output is correct
5 Correct 465 ms 25324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 375 ms 23148 KB Output is correct
2 Correct 518 ms 29548 KB Output is correct
3 Correct 573 ms 29292 KB Output is correct
4 Correct 542 ms 29292 KB Output is correct
5 Correct 551 ms 29420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 488 ms 26988 KB Output is correct
2 Correct 676 ms 34156 KB Output is correct
3 Correct 679 ms 33772 KB Output is correct
4 Correct 678 ms 33772 KB Output is correct
5 Correct 668 ms 33900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 640 ms 30772 KB Output is correct
2 Correct 769 ms 38636 KB Output is correct
3 Correct 739 ms 38252 KB Output is correct
4 Correct 791 ms 38536 KB Output is correct
5 Correct 794 ms 38376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 761 ms 37232 KB Output is correct
2 Correct 874 ms 41356 KB Output is correct
3 Correct 833 ms 40872 KB Output is correct
4 Correct 827 ms 41128 KB Output is correct
5 Correct 823 ms 40944 KB Output is correct