Submission #57465912


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using pl = pair<ll, ll>;
constexpr ll INF = 1e9 + 7;
constexpr ll mod = 1e9 + 7;
constexpr ld eps = 1e-9;
const ld PI = acos(-1);

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n;
    vector<array<int, 2>> a(n);
    for (auto &[x, y]: a)cin >> x >> y;
    map<vector<array<int, 2>>, int> res;
    auto solve = [&](auto&&solve,const vector<array<int, 2>> &state) {
        if (res.count(state))return res[state];
        auto &re = res[state];
        for (int i = 0; i < state.size(); ++i) {
            for (int j = i + 1; j < state.size(); ++j) {
                if (state[i][0] == state[j][0] || state[i][1] == state[j][1]) {
                    auto nst = state;
                    nst.erase(nst.begin() + j);
                    nst.erase(nst.begin() + i);
                    re |= !solve(solve,nst);
                }
            }
        }
        return re;
    };
    cout << (solve(solve,a)?"Takahashi":"Aoki");
}

Submission Info

Submission Time
Task E - Remove Pairs
User ZergTricky
Language C++ 20 (gcc 12.2)
Score 475
Code Size 1090 Byte
Status AC
Exec Time 1741 ms
Memory 25072 KiB

Compile Error

Main.cpp: In instantiation of ‘main()::<lambda(auto:53&&, const std::vector<std::array<int, 2> >&)> [with auto:53 = main()::<lambda(auto:53&&, const std::vector<std::array<int, 2> >&)>&]’:
Main.cpp:35:19:   required from here
Main.cpp:23:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::array<int, 2> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   23 |         for (int i = 0; i < state.size(); ++i) {
      |                         ~~^~~~~~~~~~~~~~
Main.cpp:24:35: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::array<int, 2> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   24 |             for (int j = i + 1; j < state.size(); ++j) {
      |                                 ~~^~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 475 / 475
Status
AC × 2
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 02_hand_00.txt, 02_hand_01.txt, 02_hand_02.txt, 02_hand_03.txt, 02_hand_04.txt, 02_hand_05.txt, 02_hand_06.txt, 02_hand_07.txt, 02_hand_08.txt, 02_hand_09.txt, 02_hand_10.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3344 KiB
00_sample_01.txt AC 1 ms 3436 KiB
01_random_00.txt AC 1 ms 3436 KiB
01_random_01.txt AC 1 ms 3496 KiB
01_random_02.txt AC 1 ms 3480 KiB
01_random_03.txt AC 2 ms 3420 KiB
01_random_04.txt AC 1 ms 3488 KiB
01_random_05.txt AC 1 ms 3444 KiB
01_random_06.txt AC 1 ms 3496 KiB
01_random_07.txt AC 674 ms 18944 KiB
01_random_08.txt AC 29 ms 5072 KiB
01_random_09.txt AC 2 ms 3584 KiB
01_random_10.txt AC 172 ms 9128 KiB
01_random_11.txt AC 1 ms 3440 KiB
01_random_12.txt AC 4 ms 3648 KiB
01_random_13.txt AC 1 ms 3504 KiB
01_random_14.txt AC 5 ms 3560 KiB
01_random_15.txt AC 3 ms 3636 KiB
01_random_16.txt AC 18 ms 3832 KiB
02_hand_00.txt AC 1741 ms 25072 KiB
02_hand_01.txt AC 1667 ms 25072 KiB
02_hand_02.txt AC 63 ms 6876 KiB
02_hand_03.txt AC 77 ms 7632 KiB
02_hand_04.txt AC 177 ms 10140 KiB
02_hand_05.txt AC 103 ms 7644 KiB
02_hand_06.txt AC 81 ms 7700 KiB
02_hand_07.txt AC 39 ms 4220 KiB
02_hand_08.txt AC 37 ms 4104 KiB
02_hand_09.txt AC 46 ms 4360 KiB
02_hand_10.txt AC 48 ms 4372 KiB