結果

問題 No.11 カードマッチ
ユーザー y_mazuny_mazun
提出日時 2015-04-24 00:10:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 42,624 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-20 01:00:33
合計ジャッジ時間 962 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 5 ms
6,144 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 6 ms
10,624 KB
testcase_07 AC 3 ms
5,504 KB
testcase_08 AC 4 ms
6,940 KB
testcase_09 AC 6 ms
10,624 KB
testcase_10 AC 6 ms
9,064 KB
testcase_11 AC 6 ms
8,448 KB
testcase_12 AC 7 ms
8,704 KB
testcase_13 AC 6 ms
8,260 KB
testcase_14 AC 4 ms
5,760 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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