結果
| 問題 |
No.11 カードマッチ
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2014-11-16 04:32:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 626 bytes |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 44,544 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 19:11:59 |
| 合計ジャッジ時間 | 1,175 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d %d %d", &W, &H, &N);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d %d", &mark[i], &number[i]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <vector>
#include <algorithm>
int main(){
int W, H, N;
scanf("%d %d %d", &W, &H, &N);
std::vector<int> mark(N), number(N);
for(int i=0;i<N;i++){
scanf("%d %d", &mark[i], &number[i]);
}
std::sort(mark.begin(), mark.end());
mark.erase(std::unique(mark.begin(), mark.end()), mark.end());
std::sort(number.begin(), number.end());
number.erase(std::unique(number.begin(), number.end()), number.end());
long long mn = mark.size(), nn = number.size(),
res = mn * H + nn * W - mn * nn - N;
printf("%lld\n", res);
}
tottoripaper