結果
問題 | No.586 ダブルブッキング |
ユーザー |
|
提出日時 | 2017-11-03 22:21:53 |
言語 | C++11 (gcc 4.8.5) |
結果 |
AC
|
実行時間 | 3 ms |
コード長 | 359 Byte |
コンパイル時間 | 1,102 ms |
使用メモリ | 1,508 KB |
最終ジャッジ日時 | 2019-02-01 17:35:22 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
sample1.txt | AC | 3 ms
1,508 KB |
sample2.txt | AC | 3 ms
1,508 KB |
sample3.txt | AC | 3 ms
1,508 KB |
test1.txt | AC | 2 ms
1,504 KB |
test2.txt | AC | 3 ms
1,504 KB |
test3.txt | AC | 2 ms
1,504 KB |
test4.txt | AC | 3 ms
1,508 KB |
test5.txt | AC | 3 ms
1,504 KB |
ソースコード
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int,int> P; int p1,p2; int n; int flag[1001]; int main(void){ scanf("%d%d",&p1,&p2); int ans=0; scanf("%d",&n); for(int i=0;i<n;i++){ int a; scanf("%d",&a); if(flag[a]>=1){ ans+=p1+p2; } flag[a]++; } printf("%d\n",ans); return 0; }