Submission #83675

#TimeUsernameProblemLanguageResultExecution timeMemory
83675nikolapesic2802Sticks (POI11_pat)C++14
21 / 100
653 ms33792 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back void fastscan(int &number) { bool negative = false; register int c; number = 0; c = getchar(); if (c=='-') { negative = true; c = getchar(); } for (; (c>47 && c<58); c=getchar()) number = number *10 + c - 48; if (negative) number *= -1; } int main() { int k; //scanf("%i",&k); fastscan(k); vector<set<int> > sets(k); for(int i=0;i<k;i++) { sets[i].insert(INT_MAX); int n; //scanf("%i",&n); fastscan(n); for(int j=0;j<n;j++) { int a; //scanf("%i",&a); fastscan(a); sets[i].insert(a); } } for(int i=0;i<k;i++) { for(auto p:sets[i]) { if(p==INT_MAX) continue; int m1=INT_MAX,m2=INT_MAX,c1,c2; int ma1=-1,ma2=-1,ca1,ca2; for(int j=0;j<k;j++) { if(i==j) continue; set<int>::iterator it=sets[j].lower_bound(p); int v=*it; if(v<m1) { m2=m1; c2=c1; m1=v; c1=j; } else { if(v<m2) { m2=v; c2=j; } } it--; if(it==sets[j].begin()) continue; v=*it; if(v>ma1) { ma2=ma1; ca2=ca1; ma1=v; ca1=j; } else { if(v>ma2) { ma2=v; ca2=j; } } } if(m1!=INT_MAX&&m2!=INT_MAX) { if(p+m1>m2) { printf("%i %i %i %i %i %i\n",i+1,p,c1+1,m1,c2+1,m2); return 0; } } if(ma1!=-1&&ma2!=-1&&ma1<p&&ma2<p) { if(ma1+ma2>p) { printf("%i %i %i %i %i %i\n",i+1,p,ca1+1,ma1,ca2+1,ma2); return 0; } } } } printf("NIE\n"); return 0; }

Compilation message (stderr)

pat.cpp: In function 'int main()':
pat.cpp:106:27: warning: 'ca2' may be used uninitialized in this function [-Wmaybe-uninitialized]
                     printf("%i %i %i %i %i %i\n",i+1,p,ca1+1,ma1,ca2+1,ma2);
                     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pat.cpp:106:27: warning: 'ca1' may be used uninitialized in this function [-Wmaybe-uninitialized]
pat.cpp:98:27: warning: 'c2' may be used uninitialized in this function [-Wmaybe-uninitialized]
                     printf("%i %i %i %i %i %i\n",i+1,p,c1+1,m1,c2+1,m2);
                     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pat.cpp:98:27: warning: 'c1' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...