結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  notetonous | 
| 提出日時 | 2016-04-06 14:41:24 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 5,000 ms | 
| コード長 | 495 bytes | 
| コンパイル時間 | 109 ms | 
| コンパイル使用メモリ | 21,632 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-11 20:03:13 | 
| 合計ジャッジ時間 | 797 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |   scanf("%lld %lld %lld",&W,&H,&N);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:14:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     scanf("%d %d",&s,&k);
      |     ^~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <stdlib.h>
int S[1000001];
int K[1000001];
int main(){
  long long  int W,H,N;
  int s,k;
  int s_count=0;
  int k_count=0;
  long long int ans;
  scanf("%lld %lld %lld",&W,&H,&N);
  int i,j;
  for(i=0;i<N;i++){
    scanf("%d %d",&s,&k);
    if(S[s]==0)S[s]=1;
    if(K[k]==0)K[k]=1;
  }
  for(i=1;i<=W;i++){
    if(S[i]==1)s_count++;
  }
  for(i=1;i<=H;i++){
    if(K[i]==1)k_count++;
  }
 
  ans=W*H-(W-s_count)*(H-k_count)-N;
  printf("%lld\n",ans);
  return 0;
}
            
            
            
        