結果
| 問題 | No.1338 Giant Class |
| コンテスト | |
| ユーザー |
iiljj
|
| 提出日時 | 2021-01-15 23:02:52 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,079 bytes |
| 記録 | |
| コンパイル時間 | 2,081 ms |
| コンパイル使用メモリ | 73,728 KB |
| 最終ジャッジ日時 | 2025-01-17 20:22:58 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 18 |
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include <map>
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
// clang-format off
#define RD(v) int v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
#define WT(var,buf,ptr) long v=var;ptr=0;while(v){buf[ptr++]=v%10;v/=10;}while(ptr--){*wp++=buf[ptr]+'0';}*wp++='\n';
// clang-format on
int y[100000];
int x[100000];
char wbuf[3 * 100000];
int main() {
char *rp = (char *)mmap(0l, 1l << 28, 1, 2, 0, 0ll);
char *wp = wbuf;
RD(h) RD(w) RD(q);
int *xp = x, *yp = y;
for (int i = 0; i < q; ++i) {
RD(yy) RD(xx);
*yp++ = --yy;
*xp++ = --xx;
}
std::map<int, int> mp;
xp = x, yp = y;
long prod = (long)h * w;
char buf[9];
int ptr;
for (int i = 0; i < q; ++i) {
int mi = (mp.count(*xp)) ? mp[*xp] : h; //
if (*yp < mi) {
prod -= (mi - *yp);
mp[*xp] = *yp;
}
xp++, yp++; //
WT(prod, buf, ptr);
}
write(1, wbuf, (wp - wbuf) * sizeof(*wbuf));
exit(0);
return 0;
}
iiljj