Submission #00119


ソースコード

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
38
39
40
41
42
43
44
45
46
47
48
49
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x) setprecision(x)
int main(){
int n;
cin>>n;
vlong a(n+2);
a[n]=-10000000000;
a[n+1]=10000000000;
int count=0;
bool fg=true;
int mimin=n,pumin=n+1;
rep(i,n){
cin>>a[i];
if(a[i]<0){
count++;
if(a[i]>a[mimin]){
mimin=i;
}
}
else{
fg=false;
if(a[i]<a[pumin]){
pumin=i;
}
}
}
if(count%2==1 || fg){
cout<<mimin+1<<'\n';
}
else{
cout<<pumin+1<<'\n';
}
return(0);
}

ステータス

項目 データ
問題 0003 - Product Maximization
ユーザー名 ei1918
投稿日時 2020-04-25 22:56:14
言語 C++14
状態 Wrong Answer
得点 0
ソースコード長 1158 Byte
最大実行時間 58 ms
最大メモリ使用量 1428 KB

セット

セット 得点 Cases
1 ALL 0 / 300 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 29 ms 600 KB
1
in02.txt AC 18 ms 576 KB
1
in03.txt AC 17 ms 552 KB
1
in04.txt AC 20 ms 520 KB
1
in05.txt AC 27 ms 620 KB
1
in06.txt AC 28 ms 976 KB
1
in07.txt AC 35 ms 1068 KB
1
in08.txt AC 40 ms 1248 KB
1
in09.txt AC 22 ms 704 KB
1
in10.txt AC 22 ms 628 KB
1
in11.txt AC 23 ms 492 KB
1
in12.txt AC 58 ms 1224 KB
1
in13.txt AC 38 ms 1064 KB
1
in14.txt AC 27 ms 776 KB
1
in15.txt AC 30 ms 920 KB
1
in16.txt AC 23 ms 748 KB
1
in17.txt AC 41 ms 1120 KB
1
in18.txt AC 46 ms 1252 KB
1
in19.txt WA 42 ms 960 KB
1
in20.txt AC 58 ms 1340 KB
1
in21.txt AC 46 ms 1428 KB
1
in22.txt WA 47 ms 1380 KB
1
in23.txt AC 43 ms 1332 KB
1
in24.txt AC 28 ms 648 KB
1
in25.txt AC 18 ms 492 KB
1
in26.txt AC 21 ms 464 KB
1
in27.txt AC 27 ms 564 KB
1
in28.txt AC 38 ms 1296 KB
1
in29.txt AC 48 ms 1376 KB
1
sample01.txt AC 31 ms 564 KB
1
sample02.txt AC 23 ms 664 KB
1