# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699139 |
2023-02-15T18:56:07 Z |
Ahmed57 |
Sticks (POI11_pat) |
C++14 |
|
256 ms |
15852 KB |
#include <bits/stdc++.h>
using namespace std;
vector<int> s[50];int b[50];
vector<pair<int,int>> v;
int ma1 = -1 , ma2 = 0 , ind1 = 0 , ind2 = 0 , x = 0 , d = 0 , n;
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n;
for(int i = 0;i<n;i++){
cin>>d;
for(int j = 0;j<d;j++){
cin>>x;
v.push_back({x,i});
s[i].push_back(x);
}
sort(s[i].begin(),s[i].end());
}
sort(v.begin(),v.end());
for(int i = v.size()-1;i>=0;i--){
b[v[i].second] = -1;
for(int j = 0;j<n;j++){
if(j==v[i].second)continue;
int d = lower_bound(s[j].begin(),s[j].end(),v[i].first+1)-s[j].begin();
if(d>0){
b[j]=s[j][d-1];
}else b[j] = -1;
}
int ma1 = -1 , ind1 = 0 , ma2 = -1 , ind2 = 0;
for(int j = 0;j<n;j++){
if(ma1<b[j]){
ma1 = b[j];
ind1 = j;
}
}
if(ma1==-1)continue;
for(int j = 0;j<n;j++){
if(j==ind1)continue;
if(ma2<b[j]){
ma2 = b[j];
ind2 = j;
}
}
if(ma2==-1)continue;
if(ma1+ma2<=v[i].first)continue;
cout<<v[i].second+1<<" "<<v[i].first<<" "<<ind1+1<<" "<<ma1<<" "<<ind2+1<<" "<<ma2<<endl;
return 0;
}
cout<<"NIE"<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Oczekiwano NIE |
2 |
Correct |
9 ms |
828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Oczekiwano NIE |
2 |
Correct |
12 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Oczekiwano NIE |
2 |
Correct |
29 ms |
1744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
780 KB |
Oczekiwano NIE |
2 |
Correct |
51 ms |
3020 KB |
Output is correct |
3 |
Correct |
35 ms |
1868 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
1700 KB |
Oczekiwano NIE |
2 |
Correct |
91 ms |
5660 KB |
Output is correct |
3 |
Correct |
61 ms |
3020 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
125 ms |
6580 KB |
Output is correct |
2 |
Correct |
110 ms |
5560 KB |
Output is correct |
3 |
Correct |
92 ms |
3764 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
131 ms |
6456 KB |
Output is correct |
2 |
Correct |
131 ms |
5824 KB |
Output is correct |
3 |
Correct |
136 ms |
6080 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
12584 KB |
Output is correct |
2 |
Correct |
142 ms |
5832 KB |
Output is correct |
3 |
Correct |
169 ms |
10504 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
250 ms |
12840 KB |
Output is correct |
2 |
Correct |
203 ms |
6148 KB |
Output is correct |
3 |
Correct |
224 ms |
15852 KB |
Oczekiwano NIE |