QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#124995 | #3506. Team Contest | Argo | 0 | 120ms | 44796kb | C++14 | 1.7kb | 2023-07-15 22:08:25 | 2023-07-15 22:08:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define rozmiar 1600000
int n, d, e, f, h[rozmiar];
vector<vector<int>> a, b, c;
vector<vector<int>> zawodnicy;
bool wyjebani[rozmiar];
int main(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for(int i=0;i<n;i++){
cin >> d >> e >> f;
a.push_back({d, e, f, i});
b.push_back({e, d, f, i});
c.push_back({f, d, e, i});
zawodnicy.push_back({d, e, f});
}
a.push_back({0, 0});
b.push_back({0, 0});
c.push_back({0, 0});
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
int it1=n, it2=n, it3=n;
while(1){
// cout << it1 << " " << it2 << " " << it3 << endl;
if(it1<=0 || it2<=0 || it3<=0){cout << -1 << endl;return 0;}
while(wyjebani[a[it1][3]] && it1>0)it1--;
while(wyjebani[b[it2][3]] && it2>0)it2--;
while(wyjebani[c[it3][3]] && it3>0)it3--;
if(it1<=0 || it2<=0 || it3<=0){cout << -1 << endl;return 0;}
if(a[it1][1]>=max(b[it2][0], c[it3][2]) || a[it1][2]>=max(b[it2][2], c[it3][0])){
wyjebani[a[it1][3]]=1;
it1--;
}else{
if(b[it2][1]>=max(a[it1][0], c[it3][1]) || b[it2][2]>=max(a[it1][2], c[it3][0])){
wyjebani[b[it2][3]]=1;
it2--;
}else if(c[it2][1]>=max(a[it1][0], b[it2][1]) || c[it3][2]>=max(a[it1][1], b[it2][0])){
wyjebani[c[it3][3]]=1;
it3--;
}else{
cout << a[it1][0]+b[it2][0]+c[it3][0] << endl;
return 0;
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 8
Accepted
time: 1ms
memory: 5460kb
input:
3 1 1 2 1 2 1 2 1 1
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
3 1 2 2 2 1 2 2 2 1
output:
-1
result:
ok single line: '-1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 5464kb
input:
3 3 3 3 2 2 2 1 1 1
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
4 3 1 1 2 2 2 1 1 3 1 2 1
output:
8
result:
ok single line: '8'
Test #5:
score: 0
Accepted
time: 1ms
memory: 5452kb
input:
3 1 2 3 1 3 4 1 4 2
output:
-1
result:
ok single line: '-1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 5548kb
input:
3 4 1 3 3 1 2 2 1 4
output:
-1
result:
ok single line: '-1'
Test #7:
score: 0
Accepted
time: 1ms
memory: 5460kb
input:
3 2 4 1 4 3 1 3 2 1
output:
-1
result:
ok single line: '-1'
Test #8:
score: 0
Accepted
time: 1ms
memory: 5496kb
input:
3 9 9 1 9 9 2 9 9 3
output:
-1
result:
ok single line: '-1'
Test #9:
score: 0
Accepted
time: 1ms
memory: 5504kb
input:
3 9 2 9 9 3 9 9 1 9
output:
-1
result:
ok single line: '-1'
Test #10:
score: 0
Accepted
time: 1ms
memory: 5464kb
input:
3 3 9 9 1 9 9 2 9 9
output:
-1
result:
ok single line: '-1'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
300 57761889 84542255 27050597 34660889 31001456 73541706 28145521 16239284 59747407 28301910 73147643 52729219 76934759 81682223 25122810 79313872 51831684 8459494 79291107 42746492 28469171 178085 36381730 88571483 88031596 68636497 47738858 78328954 72492907 81005026 20116327 27194915 29047676 15...
output:
298779499
result:
ok single line: '298779499'
Test #12:
score: -8
Wrong Answer
time: 1ms
memory: 5528kb
input:
236 11541369 9792582 4713403 87402689 82538784 88522804 35622147 10769145 14518449 85768984 12580765 86992032 97843742 97233030 66564513 87402689 41237008 87442884 73770719 95022375 94286048 89771996 85187794 89890546 61271783 67426819 70494968 638822 67263206 68519784 53640982 58599424 55894005 414...
output:
279216314
result:
wrong answer 1st lines differ - expected: '116772345', found: '279216314'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #36:
score: 9
Accepted
time: 120ms
memory: 44796kb
input:
150000 3 3 1 2 5 5 1 3 5 4 3 5 3 4 4 4 4 2 4 3 5 5 1 2 5 4 1 2 3 3 4 4 5 3 3 5 2 4 3 1 3 2 5 2 4 4 5 3 2 5 1 5 4 3 3 2 5 1 1 4 3 2 5 2 3 5 3 3 4 1 3 4 2 4 3 1 5 4 2 1 4 1 4 4 5 4 3 4 5 3 2 1 2 5 4 5 4 5 4 5 1 2 1 4 1 3 1 4 2 5 2 3 5 3 3 4 2 5 1 4 5 2 1 1 2 2 1 3 2 5 4 3 5 4 5 3 2 4 5 5 2 5 3 3 3 4 4...
output:
15
result:
ok single line: '15'
Test #37:
score: -9
Wrong Answer
time: 72ms
memory: 28580kb
input:
99999 1 1 2 2 4 1 2 4 5 3 4 5 1 5 5 4 2 5 1 1 2 2 4 2 2 4 4 3 4 2 4 4 5 2 4 4 1 2 2 1 1 2 1 2 1 1 5 5 1 1 1 5 3 5 2 4 1 1 4 4 2 5 5 1 1 2 3 4 4 2 4 2 4 2 5 3 3 4 1 2 2 4 5 3 3 4 2 4 5 3 2 4 5 1 1 1 3 4 4 2 4 1 1 1 1 3 5 5 3 4 1 2 4 2 3 4 5 1 2 2 1 2 1 4 4 4 1 1 1 2 1 4 1 4 5 3 5 5 2 4 5 3 4 5 3 3 4 ...
output:
-1
result:
wrong answer 1st lines differ - expected: '8', found: '-1'
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #5:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%