Submission #120771

#TimeUsernameProblemLanguageResultExecution timeMemory
120771popovicirobertSticks (POI11_pat)C++14
100 / 100
197 ms13896 KiB
#include <bits/stdc++.h> #define lsb(x) (x & (-x)) #define ll long long #define ull unsigned long long // 217 // 44 /* const int MOD = ; inline void mod(int &x) { if(x >= MOD) x -= MOD; } inline void add(int &x, int y) { x += y; mod(x); } inline void sub(int &x, int y) { x += MOD - y; mod(x); } inline void mul(int &x, int y) { x = (1LL * x * y) % MOD; } */ using namespace std; int main() { //ifstream cin("A.in"); //ofstream cout("A.out"); int i, k; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> k; vector < vector <int> > arr(k + 1); for(i = 1; i <= k; i++) { int num; cin >> num; arr[i].resize(num + 1); for(int j = 1; j <= num; j++) { cin >> arr[i][j]; } sort(next(arr[i].begin()), arr[i].end()); } for(int col = 1; col <= k; col++) { for(auto it : arr[col]) { int mx1 = 0, mx2 = 0; int c1, c2; for(i = 1; i <= k; i++) { if(i != col) { auto cur = upper_bound(arr[i].begin(), arr[i].end(), it) - arr[i].begin() - 1; if(cur > 0) { if(mx1 <= arr[i][cur]) { mx2 = mx1, c2 = c1; mx1 = arr[i][cur], c1 = i; } else if(mx2 < arr[i][cur]) { mx2 = arr[i][cur], c2 = i; } } } } if(mx1 != 0 && mx2 != 0 && mx1 + mx2 > it) { cout << col << " " << it << " " << c1 << " " << mx1 << " " << c2 << " " << mx2; return 0; } } } cout << "NIE"; //cin.close(); //cout.close(); return 0; }

Compilation message (stderr)

pat.cpp: In function 'int main()':
pat.cpp:76:85: warning: 'c2' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 cout << col << " " << it << " " << c1 << " " << mx1 << " " << c2 << " " << mx2;
                                                                                     ^~~
pat.cpp:76:58: warning: 'c1' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 cout << col << " " << it << " " << c1 << " " << mx1 << " " << c2 << " " << mx2;
                                                          ^~~
#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...