CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Neliöt
Sender:
Submission time:2015-12-20 15:29:13 +0200
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED27
#2ACCEPTED41
#3ACCEPTED32
Test results
testverdicttimegroup
#1ACCEPTED0.17 s1details
#2ACCEPTED0.20 s2details
#3ACCEPTED0.30 s3details

Code

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>

typedef long long LL;
using namespace std;

void solve(){
    vector<LL> v(4);
    cin >> v[0] >> v[1] >> v[2] >> v[3];
    sort(v.begin(), v.end());
    do{
        LL a = v[0]; LL b = v[1]; LL c = v[2]; LL d = v[3];
        if(a > b) continue;
        if(a == b && b == c && c == d){
            cout << "10-4" << "\n"; return;
        }
        if(a == b && (c == d && d == a+b)){
            cout << "10-4" << "\n"; return;
        }
        if(a != b && (c == d && d == b-a && (2*b == 3*a))){
            cout << "10-4" << "\n"; return;
        }
        if(a == b && b == c && d == a+b+c){
            cout << "10-4" << "\n"; return;   
        }
        
        //for(auto x : v) cout << x << " "; cout << endl;
    } while(next_permutation(v.begin(), v.end()));
    
    cout << "QAQ" << endl;
}

int main(){
    LL t; cin >> t;
    while(t --> 0) solve();
}


Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
100000
6 9 3 3
1 3 1 1
3 3 6 9
2 2 4 4
...

correct output
10-4
10-4
10-4
10-4
QAQ
...

user output
10-4
10-4
10-4
10-4
QAQ
...

Test 2

Group: 2

Verdict: ACCEPTED

input
100000
270 90 90 90
372 914 438 84
304 152 152 304
238 238 714 238
...

correct output
10-4
QAQ
10-4
10-4
10-4
...

user output
10-4
QAQ
10-4
10-4
10-4
...

Test 3

Group: 3

Verdict: ACCEPTED

input
100000
821863964 821863964 821863964 ...

correct output
10-4
10-4
QAQ
10-4
10-4
...

user output
10-4
10-4
QAQ
10-4
10-4
...