답안 #1067976

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1067976 2024-08-21T06:18:54 Z kunzaZa183 Archery (IOI09_archery) C++17
20 / 100
2000 ms 16840 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n,rd;
  cin>>n>>rd;
  rd-= 2*n;
  int skill;
  cin>>skill;
  vector<int> vi;
  for(int i =0 ;i < 2*n-1;i++) {
    int x;
    cin>>x;
    vi.push_back(x);
  }
  vector<int> contest[200000];
  for(int i = 0; i < n;i++)
    contest[i] = vector<int>(2);

  int minplace = 1e9,maxst = 0;
  for(int i = 0; i < 2*n;i++)
  {
    vector<int> vi2(vi);
    vi2.insert(vi2.begin() + i,skill);
    
    for(int j =0; j < n;j++)
      contest[j][0] = vi2[j*2],contest[j][1] = vi2[j*2 + 1];

    for(int k = 0 ;k < n * 2;k++) {
      vector<int> contest2[200];
      for(int j =0 ; j < n;j++) {
        if(contest[j][0]>contest[j][1])
          swap(contest[j][0], contest[j][1]);
        if(j==0) {
          contest2[j].push_back(contest[j][0]);
          contest2[n-1].push_back(contest[j][1]);
        } else {
          contest2[j].push_back(contest[j][1]);
          contest2[j-1].push_back(contest[j][0]);
        }
      }

      // for(int j = 0; j < n;j++)
      //   cout<<contest2[j][0]<<" "<<contest2[j][1]<<"  ";
      // cout<<"\n";

      for(int j = 0; j < n;j++)
        contest[j] = contest2[j];
    }

    for(int j = 0; j < n;j++)
      if(contest[j][0] > contest[j][1])
        swap(contest[j][0],contest[j][1]);
    
    int in;
    for(int j =0 ; j < n;j++)
      if(contest[j][0] == skill || contest[j][1] == skill)
        in = j;
    
    int endup;
    if(skill ==1 || skill > n ){ 
      endup = in;
    } else {
      endup = (in - rd %n + n) % n;
    }

    // cout<<i<<" "<<endup<<"\n";
    if(endup <= minplace) {
      maxst = i/2 + 1;
      minplace = endup;
    }
  }
  cout<<maxst<<"\n";
} 

Compilation message

archery.cpp: In function 'int main()':
archery.cpp:64:19: warning: 'in' may be used uninitialized in this function [-Wmaybe-uninitialized]
   64 |       endup = (in - rd %n + n) % n;
      |                ~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4956 KB Output is correct
2 Execution timed out 2095 ms 5224 KB Time limit exceeded
3 Correct 173 ms 4956 KB Output is correct
4 Execution timed out 2074 ms 5208 KB Time limit exceeded
5 Correct 6 ms 5096 KB Output is correct
6 Correct 1232 ms 5156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 4952 KB Output is correct
2 Correct 1508 ms 4956 KB Output is correct
3 Execution timed out 2066 ms 5216 KB Time limit exceeded
4 Execution timed out 2008 ms 5976 KB Time limit exceeded
5 Execution timed out 2059 ms 16272 KB Time limit exceeded
6 Correct 1405 ms 5152 KB Output is correct
7 Execution timed out 2061 ms 4956 KB Time limit exceeded
8 Execution timed out 2029 ms 5976 KB Time limit exceeded
9 Execution timed out 2005 ms 6108 KB Time limit exceeded
10 Execution timed out 2072 ms 5212 KB Time limit exceeded
11 Execution timed out 2037 ms 6152 KB Time limit exceeded
12 Execution timed out 2031 ms 5208 KB Time limit exceeded
13 Execution timed out 2072 ms 11780 KB Time limit exceeded
14 Execution timed out 2050 ms 5424 KB Time limit exceeded
15 Execution timed out 2027 ms 6876 KB Time limit exceeded
16 Correct 1490 ms 5152 KB Output is correct
17 Execution timed out 2072 ms 5212 KB Time limit exceeded
18 Execution timed out 2039 ms 5208 KB Time limit exceeded
19 Execution timed out 2076 ms 5332 KB Time limit exceeded
20 Execution timed out 2043 ms 5424 KB Time limit exceeded
21 Execution timed out 2033 ms 6108 KB Time limit exceeded
22 Execution timed out 2076 ms 6624 KB Time limit exceeded
23 Execution timed out 2075 ms 15816 KB Time limit exceeded
24 Correct 1410 ms 5148 KB Output is correct
25 Execution timed out 2021 ms 4952 KB Time limit exceeded
26 Execution timed out 2043 ms 5408 KB Time limit exceeded
27 Execution timed out 2032 ms 6108 KB Time limit exceeded
28 Execution timed out 2063 ms 11984 KB Time limit exceeded
29 Execution timed out 2040 ms 5224 KB Time limit exceeded
30 Execution timed out 2064 ms 5468 KB Time limit exceeded
31 Execution timed out 2031 ms 6364 KB Time limit exceeded
32 Execution timed out 2041 ms 16840 KB Time limit exceeded
33 Correct 1440 ms 4952 KB Output is correct
34 Correct 1372 ms 5176 KB Output is correct
35 Execution timed out 2043 ms 5212 KB Time limit exceeded
36 Execution timed out 2068 ms 5296 KB Time limit exceeded
37 Execution timed out 2033 ms 6108 KB Time limit exceeded
38 Execution timed out 2072 ms 6624 KB Time limit exceeded
39 Correct 1292 ms 5144 KB Output is correct
40 Execution timed out 2097 ms 5212 KB Time limit exceeded
41 Execution timed out 2076 ms 5212 KB Time limit exceeded
42 Execution timed out 2069 ms 5212 KB Time limit exceeded
43 Execution timed out 2072 ms 5416 KB Time limit exceeded
44 Execution timed out 2029 ms 5620 KB Time limit exceeded
45 Execution timed out 2059 ms 6112 KB Time limit exceeded
46 Execution timed out 2021 ms 6368 KB Time limit exceeded
47 Execution timed out 2075 ms 16076 KB Time limit exceeded