# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161393 | 2019-11-02T08:17:20 Z | georgerapeanu | Party (POI11_imp) | C++11 | 1112 ms | 46072 KB |
#include <cstdio> #include <vector> #include <algorithm> ///#include <ctime> ///#include <cstdlib> using namespace std; const int NMAX = 3000; int n,m; vector<int> graph[NMAX + 5]; int gr[NMAX + 5]; bool del[NMAX + 5]; int main(){ scanf("%d %d",&n,&m); for(int i = 1;i <= m;i++){ int x,y; scanf("%d %d",&x,&y); gr[x]++; gr[y]++; graph[x].push_back(y); graph[y].push_back(x); } vector<int> elim; for(int i = 1;i <= n;i++){ if(gr[i] < 2 * n / 3 - 1){ elim.push_back(i); del[i] = true; } } for(int i = 0;i < (int)elim.size();i++){ for(auto it:graph[elim[i]]){ gr[it]--; if(del[it] == false && gr[it] < 2 * n / 3 - 1){ del[it] = true; elim.push_back(it); } } } vector<pair<int,int> > nodes; for(int i = 1;i <= n;i++){ if(del[i] == false){ nodes.push_back({gr[i],i}); } } sort(nodes.begin(),nodes.end()); reverse(nodes.begin(),nodes.end()); elim.clear(); for(int i = 0;i < n / 3;i++){ elim.push_back(nodes[i].second); del[nodes[i].second] = true; } for(int i = 0;i < (int)elim.size();i++){ for(auto it:graph[elim[i]]){ gr[it]--; if(del[it] == false && gr[it] < n / 3 - 1){ del[it] = true; elim.push_back(it); } } } vector<int> ans; for(int i = 1;i <= n;i++){ if(del[i] == false){ ans.push_back(i); } } ///srand(time(NULL)); ///random_shuffle(ans.begin(),ans.end()); ans.resize(n / 3); for(auto it:ans){ printf("%d ",it); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 632 KB | Output is correct |
2 | Incorrect | 27 ms | 2168 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 1532 KB | Output is correct |
2 | Incorrect | 104 ms | 7672 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 2452 KB | Output is correct |
2 | Incorrect | 332 ms | 18960 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 75 ms | 5880 KB | Output is correct |
2 | Incorrect | 373 ms | 26968 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 229 ms | 18140 KB | Output is correct |
2 | Incorrect | 473 ms | 31376 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 419 ms | 27220 KB | Output is correct |
2 | Incorrect | 636 ms | 27100 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 554 ms | 33380 KB | Output is correct |
2 | Incorrect | 779 ms | 36728 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 670 ms | 24400 KB | Output is correct |
2 | Incorrect | 908 ms | 40396 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 944 ms | 39312 KB | Output is correct |
2 | Incorrect | 1031 ms | 44152 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 992 ms | 45036 KB | Output is correct |
2 | Incorrect | 1112 ms | 46072 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |