답안 #528086

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
528086 2022-02-19T07:44:09 Z AndresTL Archery (IOI09_archery) C++11
0 / 100
2000 ms 6632 KB
#include<bits/stdc++.h>
using namespace std;
const int LIMIT=200000;
int level[(2*LIMIT)+2];
int Objetivos, Rounds, MyArcher;
bool solve(){
  vector<pair<int,int>> Obj;
  for(int i=1;i<=Objetivos*2;i+=2){
    Obj.push_back(make_pair(level[i],level[i+1]));
  }
  int ultimo=0;
  int wins=0;
  for(int i=1;i<=Rounds;i++){
    for(int j=0;j<Objetivos;j++){
      if(j==0){
        if(Obj[j].first<Obj[j].second){
          ultimo=Obj[j].second;
        }else{
          ultimo=Obj[j].first;
          Obj[j].first=Obj[j].second;
        }
        if(Obj[j].first==MyArcher)wins++;
      }else{
        if(Obj[j].first<Obj[j].second){
          Obj[j-1].second=Obj[j].first;
          Obj[j].first=Obj[j].second;
        }else{
          Obj[j-1].second=Obj[j].second;
        }
        if(Obj[j-1].second==MyArcher)wins++;
      }
    }
    Obj[Objetivos-1].second=ultimo;    
  }
  return wins;
};
int main(){
  cin>>Objetivos>>Rounds>>MyArcher;
  for(int i=2;i<=Objetivos*2;i++){
    cin>>level[i];
  }
  int gano,mgano=0;
  int res;
  for(int i=1;i<=Objetivos*2;i++){
    level[i-1]=level[i];
    level[i]=MyArcher;
    gano=solve();
    if(mgano<=gano){
      mgano=gano;
      res=i;
    }
  }
  cout<<(res-1)/2<<'\n';
}

Compilation message

archery.cpp: In function 'int main()':
archery.cpp:53:13: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
   53 |   cout<<(res-1)/2<<'\n';
      |         ~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Execution timed out 2067 ms 304 KB Time limit exceeded
3 Execution timed out 2062 ms 204 KB Time limit exceeded
4 Execution timed out 2058 ms 372 KB Time limit exceeded
5 Incorrect 1 ms 208 KB Output isn't correct
6 Execution timed out 2074 ms 204 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 204 KB Output isn't correct
2 Execution timed out 2063 ms 204 KB Time limit exceeded
3 Execution timed out 2063 ms 332 KB Time limit exceeded
4 Execution timed out 2059 ms 768 KB Time limit exceeded
5 Execution timed out 2074 ms 5944 KB Time limit exceeded
6 Execution timed out 2070 ms 300 KB Time limit exceeded
7 Execution timed out 2086 ms 204 KB Time limit exceeded
8 Execution timed out 2081 ms 844 KB Time limit exceeded
9 Execution timed out 2072 ms 1100 KB Time limit exceeded
10 Execution timed out 2077 ms 332 KB Time limit exceeded
11 Execution timed out 2094 ms 1100 KB Time limit exceeded
12 Execution timed out 2090 ms 388 KB Time limit exceeded
13 Execution timed out 2044 ms 3976 KB Time limit exceeded
14 Execution timed out 2057 ms 472 KB Time limit exceeded
15 Execution timed out 2050 ms 1220 KB Time limit exceeded
16 Incorrect 105 ms 204 KB Output isn't correct
17 Execution timed out 2091 ms 320 KB Time limit exceeded
18 Execution timed out 2074 ms 332 KB Time limit exceeded
19 Execution timed out 2076 ms 332 KB Time limit exceeded
20 Execution timed out 2087 ms 460 KB Time limit exceeded
21 Execution timed out 2045 ms 1228 KB Time limit exceeded
22 Execution timed out 2062 ms 1184 KB Time limit exceeded
23 Execution timed out 2064 ms 6284 KB Time limit exceeded
24 Incorrect 64 ms 284 KB Output isn't correct
25 Execution timed out 2074 ms 332 KB Time limit exceeded
26 Execution timed out 2075 ms 460 KB Time limit exceeded
27 Execution timed out 2058 ms 1100 KB Time limit exceeded
28 Execution timed out 2057 ms 4048 KB Time limit exceeded
29 Execution timed out 2080 ms 332 KB Time limit exceeded
30 Execution timed out 2084 ms 460 KB Time limit exceeded
31 Execution timed out 2045 ms 960 KB Time limit exceeded
32 Execution timed out 2067 ms 6032 KB Time limit exceeded
33 Incorrect 86 ms 204 KB Output isn't correct
34 Execution timed out 2094 ms 204 KB Time limit exceeded
35 Execution timed out 2058 ms 452 KB Time limit exceeded
36 Execution timed out 2086 ms 380 KB Time limit exceeded
37 Execution timed out 2092 ms 1004 KB Time limit exceeded
38 Execution timed out 2068 ms 1100 KB Time limit exceeded
39 Execution timed out 2069 ms 224 KB Time limit exceeded
40 Execution timed out 2062 ms 332 KB Time limit exceeded
41 Execution timed out 2079 ms 332 KB Time limit exceeded
42 Execution timed out 2040 ms 332 KB Time limit exceeded
43 Execution timed out 2037 ms 460 KB Time limit exceeded
44 Execution timed out 2060 ms 588 KB Time limit exceeded
45 Execution timed out 2066 ms 936 KB Time limit exceeded
46 Execution timed out 2035 ms 1092 KB Time limit exceeded
47 Execution timed out 2067 ms 6632 KB Time limit exceeded