Please sign in first.
Submission #77365800
このソースコードは、提出者がAIへの学習を拒否しています。絶対に学習用途に使用しないでください。
The submitter has marked this source code as prohibited from use in AI training. It must not be used for AI training purposes under any circumstances.
The submitter has marked this source code as prohibited from use in AI training. It must not be used for AI training purposes under any circumstances.
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int col[300005];
int row[300005];
int main(){
memset(col,0xff,sizeof(col));
memset(row,0xff,sizeof(row));
int n,m;
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++){
int r,c;
scanf("%d%d",&r,&c);
//找到当前列对应的行并清除
row[col[c]]=-1;
col[row[r]]=-1;
row[r]=c;
col[c]=r;
}
int ans=0;
for(int i=1;i<=n;i++)if(col[i]!=-1)ans++;
printf("%d",ans);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Placing Rooks |
| User | jqcyx |
| Language | C++23 (GCC 15.2.0) |
| Score | 400 |
| Code Size | 458 Byte |
| Status | AC |
| Exec Time | 37 ms |
| Memory | 6272 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 2 ms | 6160 KiB |
| example_01.txt | AC | 2 ms | 6136 KiB |
| hand_00.txt | AC | 36 ms | 6176 KiB |
| hand_01.txt | AC | 37 ms | 6208 KiB |
| hand_02.txt | AC | 30 ms | 6160 KiB |
| hand_03.txt | AC | 31 ms | 6224 KiB |
| hand_04.txt | AC | 31 ms | 6136 KiB |
| hand_05.txt | AC | 31 ms | 6228 KiB |
| hand_06.txt | AC | 31 ms | 6224 KiB |
| hand_07.txt | AC | 21 ms | 6164 KiB |
| hand_08.txt | AC | 2 ms | 6164 KiB |
| hand_09.txt | AC | 2 ms | 6180 KiB |
| random_00.txt | AC | 32 ms | 6176 KiB |
| random_01.txt | AC | 14 ms | 6272 KiB |
| random_02.txt | AC | 36 ms | 6108 KiB |
| random_03.txt | AC | 14 ms | 6252 KiB |
| random_04.txt | AC | 3 ms | 6228 KiB |
| random_05.txt | AC | 31 ms | 6108 KiB |
| random_06.txt | AC | 18 ms | 6252 KiB |
| random_07.txt | AC | 37 ms | 6164 KiB |
| random_08.txt | AC | 11 ms | 6140 KiB |
| random_09.txt | AC | 6 ms | 6132 KiB |
| random_10.txt | AC | 9 ms | 6160 KiB |
| random_11.txt | AC | 11 ms | 6164 KiB |