QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#125012#3506. Team ContestArgo0 131ms45600kbC++142.1kb2023-07-15 22:28:062023-07-15 22:28:09

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:28:09]
  • 评测
  • 测评结果:0
  • 用时:131ms
  • 内存:45600kb
  • [2023-07-15 22:28:06]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
#define rozmiar 1600000

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, i, e, f});
        b.push_back({e, i, d, f});
        c.push_back({f, i, d, e});
        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;
    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][1]){
            wyjebani[a[it1][1]]=1;
        }else{
            if(a[it1][1]==c[it3][1]){
                wyjebani[a[it1][1]]=1;
            }else{
                if(b[it2][1]==c[it3][1]){
                    wyjebani[b[it2][1]]=1;
                }else{
                    cout << a[it1][0]+b[it2][0]+c[it3][0] << 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[it2][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
Wrong Answer

Test #1:

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

input:

3
1 1 2
1 2 1
2 1 1

output:

6

result:

ok single line: '6'

Test #2:

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

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

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: 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: 1ms
memory: 5548kb

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: 1ms
memory: 5560kb

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: 131ms
memory: 45600kb

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: 55ms
memory: 33372kb

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%