QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#287241 | #3506. Team Contest | DaiRuiChen007 | 0 | 26ms | 10156kb | C++20 | 725b | 2023-12-20 07:58:59 | 2023-12-20 07:58:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1.5e5+5;
int a[MAXN],b[MAXN],c[MAXN];
bool vis[MAXN];
priority_queue <array<int,2>> A,B,C;
signed main() {
int n;
scanf("%d",&n);
for(int i=1;i<=n;++i) {
scanf("%d%d%d",&a[i],&b[i],&c[i]);
A.push({a[i],i}),B.push({b[i],i}),C.push({c[i],i});
}
while(A.size()&&B.size()&&C.size()) {
int x=A.top()[1],y=B.top()[1],z=C.top()[1];
if(x==y) vis[x]=true;
if(y==z) vis[y]=true;
if(z==x) vis[z]=true;
if(!vis[x]&&!vis[y]&&!vis[z]) return printf("%d\n",a[x]+b[y]+c[z]),0;
while(A.size()&&vis[A.top()[1]]) A.pop();
while(B.size()&&vis[B.top()[1]]) B.pop();
while(C.size()&&vis[C.top()[1]]) C.pop();
}
puts("-1");
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: 0ms
memory: 3924kb
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: 3836kb
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: 3748kb
input:
3 3 3 3 2 2 2 1 1 1
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3864kb
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: 0ms
memory: 3756kb
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: 3828kb
input:
3 4 1 3 3 1 2 2 1 4
output:
-1
result:
ok single line: '-1'
Test #7:
score: -8
Wrong Answer
time: 0ms
memory: 3824kb
input:
3 2 4 1 4 3 1 3 2 1
output:
9
result:
wrong answer 1st lines differ - expected: '-1', found: '9'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #36:
score: 9
Accepted
time: 26ms
memory: 10156kb
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: 15ms
memory: 6688kb
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:
15
result:
wrong answer 1st lines differ - expected: '8', found: '15'
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%