# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699137 |
2023-02-15T18:50:55 Z |
Ahmed57 |
Sticks (POI11_pat) |
C++14 |
|
756 ms |
55148 KB |
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
vector<pair<int,int>> v;
ordered_set s[50];int b[50];
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].insert(x);
}
}
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 = s[j].order_of_key(v[i].first+1);
if(d>0){
b[j]=*s[j].find_by_order(d-1);
}else b[j] = -1;
}
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 |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Oczekiwano NIE |
2 |
Correct |
21 ms |
2112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Oczekiwano NIE |
2 |
Correct |
29 ms |
2628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
596 KB |
Oczekiwano NIE |
2 |
Correct |
77 ms |
5968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
1744 KB |
Oczekiwano NIE |
2 |
Correct |
152 ms |
8860 KB |
Output is correct |
3 |
Correct |
93 ms |
5888 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
4428 KB |
Oczekiwano NIE |
2 |
Correct |
271 ms |
16660 KB |
Output is correct |
3 |
Correct |
165 ms |
8636 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
330 ms |
27740 KB |
Output is correct |
2 |
Correct |
329 ms |
17924 KB |
Output is correct |
3 |
Correct |
206 ms |
13264 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
257 ms |
27724 KB |
Output is correct |
2 |
Correct |
412 ms |
20008 KB |
Output is correct |
3 |
Correct |
334 ms |
16932 KB |
Oczekiwano NIE |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
756 ms |
55148 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
650 ms |
55116 KB |
Memory limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |