結果

問題 No.11 カードマッチ
ユーザー y_mazun
提出日時 2015-04-24 00:10:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 42,496 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-10-11 19:47:50
合計ジャッジ時間 1,112 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int getInt()’:
main.cpp:7:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 | inline int getInt(){ int s; scanf("%d", &s); return s; }
      |                             ~~~~~^~~~~~~~~~

ソースコード

diff #

typedef long long ll;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  const int n = getInt();
  const int m = getInt();

  const int k = getInt();

  vector<int> a(n);
  vector<int> b(m);

  REP(i,k){
    a[getInt() - 1]++;
    b[getInt() - 1]++;
  }

  int t = 0;
  REP(i,m) t += !!b[i];

  ll ans = 0;
  REP(i,n){
    if(a[i]) ans += m - a[i];
    else ans += t;
  }

  printf("%lld\n", ans);

  return 0;
}
0