Submission #17154164
Source Code Expand
#include <bits/stdc++.h>
typedef long long int64;
const int N = 2e5;
int n, q, a[N + 5], b[N + 5];
int main() {
scanf("%d%d", &n, &q);
for (int i = 1; i <= n; i++) {
a[i] = b[i] = n;
}
int x = n, y = n;
int64 ans = (int64)(n - 2) * (n - 2);
for (int opt, k, i = 1; i <= q; i++) {
scanf("%d%d", &opt, &k);
if (opt == 1) {
if (k < y) {
std::fill(b + k, b + y, x);
y = k;
}
ans -= b[k] - 2;
} else {
if (k < x) {
std::fill(a + k, a + x, y);
x = k;
}
ans -= a[k] - 2;
}
}
printf("%lld\n", ans);
return 0;
}
Submission Info
Submission Time
2020-10-03 19:43:56+0900
Task
F - Simplified Reversi
User
siyuan
Language
C++ (GCC 9.2.1)
Score
600
Code Size
751 Byte
Status
AC
Exec Time
48 ms
Memory
5260 KiB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
10 | scanf("%d%d", &n, &q);
| ~~~~~^~~~~~~~~~~~~~~~
./Main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
17 | scanf("%d%d", &opt, &k);
| ~~~~~^~~~~~~~~~~~~~~~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
600 / 600
Status
Set Name
Test Cases
Sample
sample_01.txt, sample_02.txt, sample_03.txt
All
hand_01.txt, hand_02.txt, hand_03.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, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name
Status
Exec Time
Memory
hand_01.txt
AC
10 ms
3724 KiB
hand_02.txt
AC
2 ms
3696 KiB
hand_03.txt
AC
2 ms
3780 KiB
random_01.txt
AC
48 ms
5160 KiB
random_02.txt
AC
11 ms
5048 KiB
random_03.txt
AC
42 ms
5260 KiB
random_04.txt
AC
30 ms
4564 KiB
random_05.txt
AC
46 ms
5224 KiB
random_06.txt
AC
36 ms
4392 KiB
random_07.txt
AC
42 ms
5212 KiB
random_08.txt
AC
13 ms
4500 KiB
random_09.txt
AC
44 ms
5164 KiB
random_10.txt
AC
2 ms
3708 KiB
random_11.txt
AC
37 ms
5120 KiB
random_12.txt
AC
25 ms
4728 KiB
random_13.txt
AC
40 ms
4452 KiB
random_14.txt
AC
36 ms
4532 KiB
random_15.txt
AC
38 ms
4452 KiB
sample_01.txt
AC
3 ms
3676 KiB
sample_02.txt
AC
5 ms
5120 KiB
sample_03.txt
AC
4 ms
5172 KiB