# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161395 | 2019-11-02T08:22:00 Z | georgerapeanu | Party (POI11_imp) | C++11 | 1125 ms | 42776 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 | 376 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 | 13 ms | 632 KB | Output is correct |
2 | Incorrect | 26 ms | 2224 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 1528 KB | Output is correct |
2 | Incorrect | 103 ms | 5724 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 2452 KB | Output is correct |
2 | Incorrect | 245 ms | 12408 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 74 ms | 4728 KB | Output is correct |
2 | Incorrect | 388 ms | 17144 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 222 ms | 12536 KB | Output is correct |
2 | Incorrect | 456 ms | 18552 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 417 ms | 16120 KB | Output is correct |
2 | Incorrect | 635 ms | 22520 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 552 ms | 18408 KB | Output is correct |
2 | Incorrect | 769 ms | 34216 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 657 ms | 20984 KB | Output is correct |
2 | Incorrect | 885 ms | 37624 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 789 ms | 36876 KB | Output is correct |
2 | Incorrect | 1032 ms | 40756 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1002 ms | 41996 KB | Output is correct |
2 | Incorrect | 1125 ms | 42776 KB | Nie wszystkie wypisane osoby siê znaja |
3 | Halted | 0 ms | 0 KB | - |