Submission #35747207


Source Code Expand

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.10.17 15:39:55
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;


int main() {
    ll n;cin >> n;
    int m;cin >> m;
    if (m == 0) {
        if (n%2 == 0) {
            puts("Aoki");
        }
        else {
            puts("Takahashi");
        }
        return 0;
    }
    int a = 0;
    vector<ll> x(m);
    vector<int> y(m);
    for (int i = 0; i < m; i++) {
        cin >> x[i] >> y[i];
        if (0 < i && i < n-1) {
            if ((x[i-1]+y[i-1])%2==(x[i]+y[i])%2) {
                a += (x[i]-x[i-1]-1)%2;
                a %= 2;
            }
            else {
                a += (x[i]-x[i-1])%2;
                a %= 2;
            }
        }
    }
    ll f = x[0]-1;
    ll b = n-x.back();
    ll k = min(f/2,b/2);
    f-=2*k;
    b-=2*k;
    if (max(f,b) >= 2) {
        puts("Takahashi");
    }
    else {
        a += f+b;
        if (a&1) {
            puts("Takahashi");
        }
        else {
            puts("Aoki");
            // a = 1
        }
    }
    return 0;
}

Submission Info

Submission Time
Task C - 01 Game
User kanpurin
Language C++ (GCC 9.2.1)
Score 600
Code Size 1151 Byte
Status AC
Exec Time 123 ms
Memory 5600 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 40
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 10 ms 3552 KiB
001.txt AC 2 ms 3380 KiB
002.txt AC 2 ms 3384 KiB
003.txt AC 2 ms 3460 KiB
004.txt AC 2 ms 3552 KiB
005.txt AC 2 ms 3620 KiB
006.txt AC 2 ms 3548 KiB
007.txt AC 2 ms 3500 KiB
008.txt AC 76 ms 5496 KiB
009.txt AC 73 ms 5364 KiB
010.txt AC 2 ms 3600 KiB
011.txt AC 2 ms 3460 KiB
012.txt AC 4 ms 3556 KiB
013.txt AC 75 ms 4456 KiB
014.txt AC 44 ms 3912 KiB
015.txt AC 70 ms 4380 KiB
016.txt AC 118 ms 5368 KiB
017.txt AC 119 ms 5532 KiB
018.txt AC 120 ms 5524 KiB
019.txt AC 121 ms 5484 KiB
020.txt AC 115 ms 5444 KiB
021.txt AC 119 ms 5492 KiB
022.txt AC 119 ms 5492 KiB
023.txt AC 119 ms 5592 KiB
024.txt AC 118 ms 5548 KiB
025.txt AC 118 ms 5528 KiB
026.txt AC 119 ms 5592 KiB
027.txt AC 119 ms 5428 KiB
028.txt AC 118 ms 5520 KiB
029.txt AC 120 ms 5592 KiB
030.txt AC 119 ms 5596 KiB
031.txt AC 120 ms 5440 KiB
032.txt AC 123 ms 5432 KiB
033.txt AC 119 ms 5380 KiB
034.txt AC 119 ms 5368 KiB
035.txt AC 119 ms 5368 KiB
036.txt AC 118 ms 5600 KiB
example0.txt AC 2 ms 3384 KiB
example1.txt AC 2 ms 3580 KiB
example2.txt AC 2 ms 3380 KiB