Submission #1141286

#TimeUsernameProblemLanguageResultExecution timeMemory
1141286rlx0090Sticks (POI11_pat)C++20
28 / 100
539 ms30516 KiB
#include <iostream> #include <vector> #include <fstream> #include <cstring> #include <string> #include <queue> #include <algorithm> #include <cmath> #include <map> #include <set> #include <cfloat> #include <random> #include <complex> #include<assert.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int k; cin >> k; vector<pair<int, int> > g; int size = 0; for(int i = 0; i < k; ++i) { int n; cin >> n; set<int> q; int cnt = 0; for(int j = 0; j < n; ++j) { int x; cin >> x; if(q.count(x)) continue; q.insert(x); cnt++; g.push_back({x, i + 1}); } size += cnt; } sort(g.rbegin(), g.rend()); for(int i = 0; i < size - 2; ++i) { int j = i + 2; //cout << g[i].first << " " << g[i + 1].first << " " << g[j].first << endl; if(g[i + 1].first + g[j].first > g[i].first) { int c1 = g[i].second, c2 = g[i + 1].second, c3 = g[j].second; //cout << "c : " << c1 << " " << c2 << " " << c3 << endl; if(c1 != c2 && c1 != c3 && c2 != c3) { cout << c1 << ' ' << g[i].first << ' ' << c2 << ' ' << g[i + 1].first << ' ' << c3 << ' ' << g[j].first; exit(0); } } while(j < size && g[j].first == g[j + 1].first) { //cout << g[i].first << " " << g[i + 1].first << " " << g[j + 1].first << endl; if(g[i + 1].first + g[j + 1].first > g[i].first) { int c1 = g[i].second, c2 = g[i + 1].second, c3 = g[j + 1].second; //cout << "c : " << c1 << " " << c2 << " " << c3 << endl; if(c1 != c2 && c1 != c3 && c2 != c3) { cout << c1 << ' ' << g[i].first << ' ' << c2 << ' ' << g[i + 1].first << ' ' << c3 << ' ' << g[j + 1].first; exit(0); } } j++; } } cout << "NIE"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...