提出 #69843751
ソースコード 拡げる
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define int long long
#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
typedef pair<int, int> PI;
typedef pair<int, pair<int, int>> PII;
static const int INF = 1010000000000000017LL;
static const double eps = 1e-12;
static const double pi = 3.14159265358979323846;
static const int dx[4] = {1, -1, 0, 0};
static const int dy[4] = {0, 0, 1, -1};
static const int ddx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
static const int ddy[8] = {0, 0, 1, -1, 1, -1, 1, -1};
template <class T>
inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <class T>
inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
int N, Q;
signed main() {
cin >> N >> Q;
vector<int> X(N);
for (int i = 0; i < N; ++i) {
X[i] = 1;
}
int mi = 0;
while (Q--) {
int x, y;
cin >> x >> y;
x--, y--;
int cnt = 0;
for (int i = mi; i <= x; ++i) {
X[y] += X[i];
cnt += X[i];
X[i] = 0;
}
chmax(mi, x);
cout << cnt << endl;
}
}
提出情報
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
300 / 300 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
sample_01.txt |
| All |
hand_01.txt, hand_02.txt, hand_03.txt, sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| hand_01.txt |
AC |
267 ms |
11024 KiB |
| hand_02.txt |
AC |
268 ms |
11188 KiB |
| hand_03.txt |
AC |
267 ms |
11076 KiB |
| sample_01.txt |
AC |
1 ms |
3568 KiB |
| test_01.txt |
AC |
1 ms |
3568 KiB |
| test_02.txt |
AC |
268 ms |
11192 KiB |
| test_03.txt |
AC |
268 ms |
11024 KiB |
| test_04.txt |
AC |
269 ms |
11032 KiB |
| test_05.txt |
AC |
274 ms |
11192 KiB |
| test_06.txt |
AC |
272 ms |
11100 KiB |
| test_07.txt |
AC |
266 ms |
11068 KiB |
| test_08.txt |
AC |
271 ms |
11052 KiB |
| test_09.txt |
AC |
269 ms |
11112 KiB |
| test_10.txt |
AC |
241 ms |
3568 KiB |
| test_11.txt |
AC |
240 ms |
3492 KiB |
| test_12.txt |
AC |
239 ms |
3532 KiB |
| test_13.txt |
AC |
240 ms |
3508 KiB |
| test_14.txt |
AC |
267 ms |
11132 KiB |
| test_15.txt |
AC |
260 ms |
11120 KiB |
| test_16.txt |
AC |
269 ms |
11112 KiB |
| test_17.txt |
AC |
267 ms |
11116 KiB |
| test_18.txt |
AC |
258 ms |
11024 KiB |
| test_19.txt |
AC |
267 ms |
11100 KiB |
| test_20.txt |
AC |
270 ms |
11116 KiB |
| test_21.txt |
AC |
270 ms |
11136 KiB |
| test_22.txt |
AC |
269 ms |
11164 KiB |