Submission #00026


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
int price[1000] = { 0 };
int vote[1000] = { 0 };
cin >> n >> m;
for(int i = 0; i < n; ++i) {
cin >> price[i];
}
int p;
for(int i = 0; i < m; ++i) {
cin >> p;
for(int j = 0; j < n; ++j) {
if(p >= price[j]) {
vote[j]++;
break;
}
}
}
int idx = 0;
for(int i = 1; i < n; ++i) {
if(vote[i] > vote[idx]) {
idx = i;
}
}
cout << idx + 1 << endl;
}

ステータス

項目 データ
問題 0002 - 投票(vote)
ユーザー名 ei1503
投稿日時 2016-12-02 15:42:09
言語 C++11
状態 Accepted
得点 100
ソースコード長 622 Byte
最大実行時間 28 ms
最大メモリ使用量 716 KB

セット

セット 得点 Cases
1 入力1 20 / 20 *1.txt
2 入力2 20 / 20 *[12].txt
3 入力3 20 / 20 *[1-3].txt
4 入力4 20 / 20 *[1-4].txt
5 入力5 20 / 20 *[1-5].txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
2014-yo-t2-in1.txt AC 21 ms 480 KB
1
2
3
4
5
2014-yo-t2-in2.txt AC 17 ms 716 KB
2
3
4
5
2014-yo-t2-in3.txt AC 23 ms 564 KB
3
4
5
2014-yo-t2-in4.txt AC 18 ms 548 KB
4
5
2014-yo-t2-in5.txt AC 28 ms 656 KB
5