CSES - Putka Open 2015 – 6/6 - Results
Submission details
Task:Tutkat
Sender:
Submission time:2015-12-04 23:13:03 +0200
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED14
#2ACCEPTED26
#3ACCEPTED60
Test results
testverdicttimegroup
#1ACCEPTED0.05 s1details
#2ACCEPTED0.04 s1details
#3ACCEPTED0.05 s1details
#4ACCEPTED0.06 s1details
#5ACCEPTED0.05 s1details
#6ACCEPTED0.06 s1details
#7ACCEPTED0.06 s1details
#8ACCEPTED0.05 s1details
#9ACCEPTED0.06 s1details
#10ACCEPTED0.06 s1details
#11ACCEPTED0.05 s2details
#12ACCEPTED0.06 s2details
#13ACCEPTED0.05 s2details
#14ACCEPTED0.06 s2details
#15ACCEPTED0.06 s2details
#16ACCEPTED0.05 s2details
#17ACCEPTED0.05 s2details
#18ACCEPTED0.04 s2details
#19ACCEPTED0.05 s2details
#20ACCEPTED0.06 s2details
#21ACCEPTED0.06 s3details
#22ACCEPTED0.06 s3details
#23ACCEPTED0.06 s3details
#24ACCEPTED0.06 s3details
#25ACCEPTED0.05 s3details
#26ACCEPTED0.06 s3details
#27ACCEPTED0.06 s3details
#28ACCEPTED0.07 s3details
#29ACCEPTED0.06 s3details
#30ACCEPTED0.07 s3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:42:9: warning: unused variable 'py' [-Wunused-variable]
     int py = -1;
         ^
input/code.cpp:43:9: warning: unused variable 'px' [-Wunused-variable]
     int px = -1;
         ^
input/code.cpp:44:10: warning: unused variable 'by' [-Wunused-variable]
     bool by = true;
          ^
input/code.cpp:45:10: warning: unused variable 'bx' [-Wunused-variable]
     bool bx = true;
          ^
input/code.cpp:53:10: warning: unused variable 'b' [-Wunused-variable]
     bool b = true;
          ^
input/code.cpp: In function 'std::string to_string(int)':
input/code.cpp:93:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < s.length(); i++) t += s[s.length() - i - 1];
                       ^

Code

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <queue>

#define uint unsigned int
#define INF 999999999
#define ll long long
#define M 1000000007
#define E 0.0000001
#define N 1<<16;

using namespace std;

string to_string (const int n);
int stoi (const string s);

int gcd (const int a, const int b) {
    if (b == 0) {
        if (a != 0) return a;
        else return 1;
    }
    return gcd(b, a % b);
}

int main () {
    cin.sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin>>n;
    if (n <= 2) {
        cout<<"QAQ"<<endl;
        return 0;
    }

    int py = -1;
    int px = -1;
    bool by = true;
    bool bx = true;
    vector<pair<int, int>> v;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin>>x>>y;
        v.push_back(make_pair(x, y));
    }

    bool b = true;
    int kx = 0;
    int ky = 0;
    for (int i = 1; i < n; i++) {
        int x = v[0].first - v[i].first;
        int y = v[0].second - v[i].second;
        if (x == 0 && y == 0) continue;

        if (x < 0) {
            x = -x;
            y = -y;
        }

        //cout<<x<<" "<<y<<endl;
        int g = gcd(x, y);
        x /= g;
        y /= g;
        //cout<<x<<" "<<y<<endl<<endl;

        if (i == 1) {
            kx = x;
            ky = y;
        } else if (kx != x || ky != y) {
            cout<<"10-4"<<endl;
            return 0;
        }
    }

    cout<<"QAQ"<<endl;

    return 0;
}

string to_string (int n) {
    string s;
    string t;
    while (n) {
        s += (n % 10) + '0';
        n /= 10;
    }
    for (int i = 0; i < s.length(); i++) t += s[s.length() - i - 1];
    return t;
}

int stoi (const string s) {
    int n = 0;
    for (char c : s) n = (n * 10) + (c - '0');
    return n;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
1
4 0

correct output
QAQ

user output
QAQ

Test 2

Group: 1

Verdict: ACCEPTED

input
2
8 7
0 0

correct output
QAQ

user output
QAQ

Test 3

Group: 1

Verdict: ACCEPTED

input
10
3 -5
2 -5
-5 -5
8 -5
...

correct output
QAQ

user output
QAQ

Test 4

Group: 1

Verdict: ACCEPTED

input
10
5 -10
5 1
5 1
5 2
...

correct output
QAQ

user output
QAQ

Test 5

Group: 1

Verdict: ACCEPTED

input
10
6 -1
-9 -1
-10 -1
-6 -1
...

correct output
QAQ

user output
QAQ

Test 6

Group: 1

Verdict: ACCEPTED

input
10
10 9
-3 -4
-6 -7
-9 -10
...

correct output
QAQ

user output
QAQ

Test 7

Group: 1

Verdict: ACCEPTED

input
10
-4 6
-3 4
-6 10
-2 2
...

correct output
QAQ

user output
QAQ

Test 8

Group: 1

Verdict: ACCEPTED

input
10
0 -5
3 -1
-8 7
-7 -4
...

correct output
10-4

user output
10-4

Test 9

Group: 1

Verdict: ACCEPTED

input
10
-6 9
0 -2
4 -6
-3 -10
...

correct output
10-4

user output
10-4

Test 10

Group: 1

Verdict: ACCEPTED

input
10
-8 6
-2 6
2 7
4 4
...

correct output
10-4

user output
10-4

Test 11

Group: 2

Verdict: ACCEPTED

input
1
-441 481

correct output
QAQ

user output
QAQ

Test 12

Group: 2

Verdict: ACCEPTED

input
2
839 909
-200 80

correct output
QAQ

user output
QAQ

Test 13

Group: 2

Verdict: ACCEPTED

input
1000
-423 925
-472 925
-809 925
326 925
...

correct output
QAQ

user output
QAQ

Test 14

Group: 2

Verdict: ACCEPTED

input
1000
-762 -767
-762 200
-762 -334
-762 209
...

correct output
QAQ

user output
QAQ

Test 15

Group: 2

Verdict: ACCEPTED

input
10
3 7
-2 -3
-4 -7
3 7
...

correct output
QAQ

user output
QAQ

Test 16

Group: 2

Verdict: ACCEPTED

input
1000
801 799
-260 -262
-67 -69
-554 -556
...

correct output
QAQ

user output
QAQ

Test 17

Group: 2

Verdict: ACCEPTED

input
1000
-272 -2
69 -2
751 -2
-52 -2
...

correct output
QAQ

user output
QAQ

Test 18

Group: 2

Verdict: ACCEPTED

input
1000
-489 -811
-643 -824
-277 174
444 765
...

correct output
10-4

user output
10-4

Test 19

Group: 2

Verdict: ACCEPTED

input
1000
489 835
-200 127
-381 726
77 -521
...

correct output
10-4

user output
10-4

Test 20

Group: 2

Verdict: ACCEPTED

input
1000
281 736
-124 -915
786 -855
114 989
...

correct output
10-4

user output
10-4

Test 21

Group: 3

Verdict: ACCEPTED

input
1
-3456 -2745

correct output
QAQ

user output
QAQ

Test 22

Group: 3

Verdict: ACCEPTED

input
2
-251857 -954786
503100 816554

correct output
QAQ

user output
QAQ

Test 23

Group: 3

Verdict: ACCEPTED

input
100000
330161 -746892
220170 -746892
-65044 -746892
806626 -746892
...

correct output
QAQ

user output
QAQ

Test 24

Group: 3

Verdict: ACCEPTED

input
100000
722581 -574844
722581 -466372
722581 664802
722581 -105614
...

correct output
QAQ

user output
QAQ

Test 25

Group: 3

Verdict: ACCEPTED

input
10
-1 -2
-2 -4
-5 -10
3 6
...

correct output
QAQ

user output
QAQ

Test 26

Group: 3

Verdict: ACCEPTED

input
100000
-203540 -407080
485311 970622
111563 223126
-440181 -880362
...

correct output
QAQ

user output
QAQ

Test 27

Group: 3

Verdict: ACCEPTED

input
100000
68694 137388
36535 73070
72667 145334
-261754 -523508
...

correct output
QAQ

user output
QAQ

Test 28

Group: 3

Verdict: ACCEPTED

input
100000
282590 559482
857807 -597385
957181 139364
-710955 660838
...

correct output
10-4

user output
10-4

Test 29

Group: 3

Verdict: ACCEPTED

input
100000
-228024 -516020
-906860 278692
-460599 616754
194654 637343
...

correct output
10-4

user output
10-4

Test 30

Group: 3

Verdict: ACCEPTED

input
100000
903962 491932
-444159 -408066
-444246 262614
678743 52561
...

correct output
10-4

user output
10-4