QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#648232#3506. Team ContestKiharaTouma#0 25ms7312kbC++141.4kb2024-10-17 17:47:532024-10-17 17:47:58

Judging History

你现在查看的是最新测评结果

  • [2024-10-17 17:47:58]
  • 评测
  • 测评结果:0
  • 用时:25ms
  • 内存:7312kb
  • [2024-10-17 17:47:53]
  • 提交

answer

//qoj3506
#include <bits/stdc++.h>
using namespace std;

int vs[150010];
int n;

int main(){
    scanf("%d", &n);
    priority_queue<pair<int, int> > a, b, c;
    for(int i = 1; i <= n; ++ i){
        int x, y, z;
        scanf("%d%d%d", &x, &y, &z);
        a.push(make_pair(x, i));
        b.push(make_pair(y, i));
        c.push(make_pair(z, i));
    }
    while(a.size() && b.size() && c.size()){
        pair<int, int> x = a.top();
        pair<int, int> y = b.top();
        pair<int, int> z = c.top();
        if(vs[x.second]){
            a.pop();
            continue;
        }
        if(vs[y.second]){
            b.pop();
            continue;
        }
        if(vs[z.second]){
            c.pop();
            continue;
        }
        if(x.second == y.second && y.second == z.second){
            vs[x.second] = 1;
            a.pop();
            b.pop();
            c.pop();
        } else if(x.second == y.second){
            vs[x.second] = 1;
            a.pop();
            b.pop();
        } else if(y.second == z.second){
            vs[y.second] = 1;
            b.pop();
            c.pop();
        } else if(x.second == z.second){
            vs[x.second] = 1;
            a.pop();
            c.pop();
        } else {
            printf("%d\n", x.first + y.first + z.first);
            return 0;
        }
    }
    puts("-1");
    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 0ms
memory: 3856kb

input:

3
1 1 2
1 2 1
2 1 1

output:

6

result:

ok single line: '6'

Test #2:

score: 8
Accepted
time: 0ms
memory: 3952kb

input:

3
1 2 2
2 1 2
2 2 1

output:

-1

result:

ok single line: '-1'

Test #3:

score: 8
Accepted
time: 0ms
memory: 3760kb

input:

3
3 3 3
2 2 2
1 1 1

output:

-1

result:

ok single line: '-1'

Test #4:

score: 8
Accepted
time: 0ms
memory: 3792kb

input:

4
3 1 1
2 2 2
1 1 3
1 2 1

output:

8

result:

ok single line: '8'

Test #5:

score: 8
Accepted
time: 0ms
memory: 3676kb

input:

3
1 2 3
1 3 4
1 4 2

output:

-1

result:

ok single line: '-1'

Test #6:

score: 8
Accepted
time: 0ms
memory: 3664kb

input:

3
4 1 3
3 1 2
2 1 4

output:

-1

result:

ok single line: '-1'

Test #7:

score: 0
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: 25ms
memory: 7312kb

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: 0
Wrong Answer
time: 19ms
memory: 5856kb

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%