結果
問題 | No.11 カードマッチ |
ユーザー |
![]() |
提出日時 | 2021-04-13 23:02:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 618 bytes |
コンパイル時間 | 479 ms |
コンパイル使用メモリ | 64,280 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 01:51:58 |
合計ジャッジ時間 | 1,196 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <iostream>using namespace std;int main(){bool existw[1000001]={};bool existh[1000001]={};int W;int H;int N;cin>>W>>H>>N;for(int i=0;i<N;i++){int s,k;cin>>s>>k;existw[s]=existh[k]=true;}long long int wcount=0;long long int hcount=0;for(int i=1;i<=W;i++){if (existw[i]){wcount++;}}for(int j=1;j<=H;j++){if (existh[j]){hcount++;}}long long int ans;ans = wcount*H+hcount*W;ans -= wcount*hcount;ans -= N;cout<<ans<<endl;}