QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#125015#3506. Team ContestArgo0 165ms49172kbC++141.6kb2023-07-15 22:32:172023-07-15 22:32:21

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-15 22:32:21]
  • 评测
  • 测评结果:0
  • 用时:165ms
  • 内存:49172kb
  • [2023-07-15 22:32:17]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
#define rozmiar 160000

long long n, d, e, f, h[rozmiar];
vector<vector<long long>> a, b, c;
vector<vector<long long>> 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, 0, 0});
    b.push_back({0, 0, 0, 0});
    c.push_back({0, 0, 0, 0});
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    int it1=n, it2=n, it3=n;
    for(int i=0;i<n+4;i++)wyjebani[i]=0;
    while(1){
        //  cout << it1 << " " << it2 << " " << it3 << endl;
        if(it1<=0 || it2<=0 || it3<=0){cout << -1 << endl;return 0;}
        while(wyjebani[a[it1][1]] && it1>0)it1--;
        while(wyjebani[b[it2][1]] && it2>0)it2--;
        while(wyjebani[c[it3][1]] && it3>0)it3--;
        if(it1<=0 || it2<=0 || it3<=0){cout << -1 << endl;return 0;} 
        if(a[it1][1]>=b[it2][0] || a[it1][2]>=c[it3][0]){
            wyjebani[a[it1][3]]=1;
            it1--;
        }else{
            if(b[it2][1]>=a[it1][0] || b[it2][2]>=c[it3][0]){
            wyjebani[b[it2][3]]=1;
                it2--;
            }else if(c[it3][1]>=a[it1][0] || c[it3][2]>=b[it2][0]){
            wyjebani[c[it3][3]]=1;
                it3--;
            }else{
                cout << a[it1][0]+b[it2][0]+c[it3][0] << endl;
                return 0;
            }
        }
        
    }
}

详细

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 8
Accepted
time: 1ms
memory: 3504kb

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: 3420kb

input:

3
1 2 2
2 1 2
2 2 1

output:

-1

result:

ok single line: '-1'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3476kb

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: 3440kb

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: 3452kb

input:

3
1 2 3
1 3 4
1 4 2

output:

-1

result:

ok single line: '-1'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3504kb

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: 3456kb

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: 3480kb

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: 3424kb

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: 3436kb

input:

3
3 9 9
1 9 9
2 9 9

output:

-1

result:

ok single line: '-1'

Test #11:

score: -8
Runtime Error

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:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #36:

score: 9
Accepted
time: 165ms
memory: 49172kb

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: 101ms
memory: 31368kb

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%