Submission #53617128
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
const int N = 18;
int n;
struct node{
int x,y;
};
node a[N+5];
int dp[(1<<N)+5][2];
int main() {
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i].x>>a[i].y;
for(int S=0;S<(1<<n);S++){
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){
if(i!=j&&((S>>(i-1))&1)&&((S>>(j-1))&1))if(a[i].x==a[j].x||a[i].y==a[j].y){
if(!dp[S-(1<<(i-1))-(1<<(j-1))][1])dp[S][0]=1;
}
}
for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){
if(i!=j&&((S>>(i-1))&1)&&((S>>(j-1))&1))if(a[i].x==a[j].x||a[i].y==a[j].y){
if(!dp[S-(1<<(i-1))-(1<<(j-1))][0])dp[S][1]=1;
}
}
// cout<<S<<' '<<dp[S][0]<<'\n';
}
cout<<(dp[(1<<n)-1][0]?"Takahashi":"Aoki");
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Remove Pairs |
| User | Nicrobott |
| Language | C++ 20 (gcc 12.2) |
| Score | 475 |
| Code Size | 840 Byte |
| Status | AC |
| Exec Time | 508 ms |
| Memory | 5732 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 475 / 475 | ||||
| Status |
|
|
| 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 | 3464 KiB |
| 00_sample_01.txt | AC | 1 ms | 3656 KiB |
| 01_random_00.txt | AC | 162 ms | 3456 KiB |
| 01_random_01.txt | AC | 16 ms | 3524 KiB |
| 01_random_02.txt | AC | 1 ms | 3684 KiB |
| 01_random_03.txt | AC | 1 ms | 3460 KiB |
| 01_random_04.txt | AC | 1 ms | 3508 KiB |
| 01_random_05.txt | AC | 16 ms | 3648 KiB |
| 01_random_06.txt | AC | 1 ms | 3560 KiB |
| 01_random_07.txt | AC | 498 ms | 5604 KiB |
| 01_random_08.txt | AC | 411 ms | 5732 KiB |
| 01_random_09.txt | AC | 2 ms | 3512 KiB |
| 01_random_10.txt | AC | 217 ms | 4484 KiB |
| 01_random_11.txt | AC | 1 ms | 3544 KiB |
| 01_random_12.txt | AC | 10 ms | 3624 KiB |
| 01_random_13.txt | AC | 1 ms | 3496 KiB |
| 01_random_14.txt | AC | 10 ms | 3560 KiB |
| 01_random_15.txt | AC | 5 ms | 3496 KiB |
| 01_random_16.txt | AC | 49 ms | 3816 KiB |
| 02_hand_00.txt | AC | 365 ms | 5660 KiB |
| 02_hand_01.txt | AC | 383 ms | 5588 KiB |
| 02_hand_02.txt | AC | 430 ms | 5536 KiB |
| 02_hand_03.txt | AC | 430 ms | 5584 KiB |
| 02_hand_04.txt | AC | 452 ms | 5528 KiB |
| 02_hand_05.txt | AC | 437 ms | 5592 KiB |
| 02_hand_06.txt | AC | 423 ms | 5548 KiB |
| 02_hand_07.txt | AC | 482 ms | 5540 KiB |
| 02_hand_08.txt | AC | 489 ms | 5544 KiB |
| 02_hand_09.txt | AC | 504 ms | 5436 KiB |
| 02_hand_10.txt | AC | 508 ms | 5508 KiB |