답안 #828384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
828384 2023-08-17T09:04:52 Z Amylopectin 송신탑 (IOI22_towers) C++17
23 / 100
4000 ms 48440 KB
#include "towers.h"
#include <stdio.h>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int mxn = 2e6 + 10,mxi = 2e9 + 10;
int n,he[mxn] = {};
vector<int> se[mxn] = {};
void init(int N, std::vector<int> H) 
{
  int i,j,cn,cm,fn,fm;
  n = N;
  for(i=0; i<n; i++)
  {
    he[i] = H[i];
  }
  return ;
}

int max_towers(int cl, int cr, int d) 
{
  int i,j,cn,cm,fn,fm,cmi = -1,cma,beh = mxi,cou = 0;
  for(i=cl; i<=cr; i++)
  {
    if(cmi == -1)
    {
      cmi = he[i];
    }
    else 
    {
      cmi = min(cmi,he[i]);
    }
    if(he[i] - cmi >= d && beh - cmi >= d)
    {
      cou ++;
      beh = he[i];
      cmi = -1;
    }
    else 
    {
      if(he[i] > beh)
      {
        beh = he[i];
        cmi = -1;
      }
    }
  }
  if(cmi != -1 && beh - cmi >= d)
  {
    cou ++;
  }
  return cou;
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:12:9: warning: unused variable 'j' [-Wunused-variable]
   12 |   int i,j,cn,cm,fn,fm;
      |         ^
towers.cpp:12:11: warning: unused variable 'cn' [-Wunused-variable]
   12 |   int i,j,cn,cm,fn,fm;
      |           ^~
towers.cpp:12:14: warning: unused variable 'cm' [-Wunused-variable]
   12 |   int i,j,cn,cm,fn,fm;
      |              ^~
towers.cpp:12:17: warning: unused variable 'fn' [-Wunused-variable]
   12 |   int i,j,cn,cm,fn,fm;
      |                 ^~
towers.cpp:12:20: warning: unused variable 'fm' [-Wunused-variable]
   12 |   int i,j,cn,cm,fn,fm;
      |                    ^~
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:23:9: warning: unused variable 'j' [-Wunused-variable]
   23 |   int i,j,cn,cm,fn,fm,cmi = -1,cma,beh = mxi,cou = 0;
      |         ^
towers.cpp:23:11: warning: unused variable 'cn' [-Wunused-variable]
   23 |   int i,j,cn,cm,fn,fm,cmi = -1,cma,beh = mxi,cou = 0;
      |           ^~
towers.cpp:23:14: warning: unused variable 'cm' [-Wunused-variable]
   23 |   int i,j,cn,cm,fn,fm,cmi = -1,cma,beh = mxi,cou = 0;
      |              ^~
towers.cpp:23:17: warning: unused variable 'fn' [-Wunused-variable]
   23 |   int i,j,cn,cm,fn,fm,cmi = -1,cma,beh = mxi,cou = 0;
      |                 ^~
towers.cpp:23:20: warning: unused variable 'fm' [-Wunused-variable]
   23 |   int i,j,cn,cm,fn,fm,cmi = -1,cma,beh = mxi,cou = 0;
      |                    ^~
towers.cpp:23:32: warning: unused variable 'cma' [-Wunused-variable]
   23 |   int i,j,cn,cm,fn,fm,cmi = -1,cma,beh = mxi,cou = 0;
      |                                ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1379 ms 47904 KB Output is correct
2 Execution timed out 4014 ms 48300 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 47184 KB Output is correct
2 Correct 21 ms 47220 KB Output is correct
3 Correct 24 ms 47168 KB Output is correct
4 Correct 24 ms 47244 KB Output is correct
5 Correct 24 ms 47276 KB Output is correct
6 Correct 25 ms 47240 KB Output is correct
7 Correct 24 ms 47184 KB Output is correct
8 Correct 30 ms 47168 KB Output is correct
9 Correct 24 ms 47224 KB Output is correct
10 Correct 23 ms 47172 KB Output is correct
11 Correct 24 ms 47188 KB Output is correct
12 Correct 24 ms 47184 KB Output is correct
13 Correct 24 ms 47164 KB Output is correct
14 Correct 24 ms 47184 KB Output is correct
15 Correct 31 ms 47176 KB Output is correct
16 Correct 25 ms 47272 KB Output is correct
17 Correct 24 ms 47228 KB Output is correct
18 Correct 23 ms 47184 KB Output is correct
19 Correct 25 ms 47184 KB Output is correct
20 Correct 24 ms 47184 KB Output is correct
21 Correct 23 ms 47164 KB Output is correct
22 Correct 25 ms 47184 KB Output is correct
23 Correct 25 ms 47212 KB Output is correct
24 Correct 24 ms 47184 KB Output is correct
25 Correct 24 ms 47184 KB Output is correct
26 Correct 24 ms 47188 KB Output is correct
27 Correct 24 ms 47184 KB Output is correct
28 Correct 27 ms 47200 KB Output is correct
29 Correct 24 ms 47164 KB Output is correct
30 Correct 25 ms 47184 KB Output is correct
31 Correct 25 ms 47284 KB Output is correct
32 Correct 24 ms 47192 KB Output is correct
33 Correct 24 ms 47232 KB Output is correct
34 Correct 25 ms 47168 KB Output is correct
35 Correct 24 ms 47184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 47184 KB Output is correct
2 Correct 21 ms 47220 KB Output is correct
3 Correct 24 ms 47168 KB Output is correct
4 Correct 24 ms 47244 KB Output is correct
5 Correct 24 ms 47276 KB Output is correct
6 Correct 25 ms 47240 KB Output is correct
7 Correct 24 ms 47184 KB Output is correct
8 Correct 30 ms 47168 KB Output is correct
9 Correct 24 ms 47224 KB Output is correct
10 Correct 23 ms 47172 KB Output is correct
11 Correct 24 ms 47188 KB Output is correct
12 Correct 24 ms 47184 KB Output is correct
13 Correct 24 ms 47164 KB Output is correct
14 Correct 24 ms 47184 KB Output is correct
15 Correct 31 ms 47176 KB Output is correct
16 Correct 25 ms 47272 KB Output is correct
17 Correct 24 ms 47228 KB Output is correct
18 Correct 23 ms 47184 KB Output is correct
19 Correct 25 ms 47184 KB Output is correct
20 Correct 24 ms 47184 KB Output is correct
21 Correct 23 ms 47164 KB Output is correct
22 Correct 25 ms 47184 KB Output is correct
23 Correct 25 ms 47212 KB Output is correct
24 Correct 24 ms 47184 KB Output is correct
25 Correct 24 ms 47184 KB Output is correct
26 Correct 24 ms 47188 KB Output is correct
27 Correct 24 ms 47184 KB Output is correct
28 Correct 27 ms 47200 KB Output is correct
29 Correct 24 ms 47164 KB Output is correct
30 Correct 25 ms 47184 KB Output is correct
31 Correct 25 ms 47284 KB Output is correct
32 Correct 24 ms 47192 KB Output is correct
33 Correct 24 ms 47232 KB Output is correct
34 Correct 25 ms 47168 KB Output is correct
35 Correct 24 ms 47184 KB Output is correct
36 Correct 33 ms 47916 KB Output is correct
37 Correct 33 ms 48328 KB Output is correct
38 Correct 32 ms 48336 KB Output is correct
39 Correct 32 ms 48336 KB Output is correct
40 Correct 32 ms 48344 KB Output is correct
41 Correct 34 ms 48372 KB Output is correct
42 Correct 33 ms 48336 KB Output is correct
43 Correct 34 ms 48416 KB Output is correct
44 Correct 38 ms 48328 KB Output is correct
45 Correct 41 ms 48424 KB Output is correct
46 Correct 34 ms 48440 KB Output is correct
47 Correct 33 ms 48440 KB Output is correct
48 Correct 33 ms 48328 KB Output is correct
49 Correct 33 ms 48336 KB Output is correct
50 Correct 32 ms 48420 KB Output is correct
51 Correct 33 ms 48304 KB Output is correct
52 Correct 34 ms 48420 KB Output is correct
53 Correct 33 ms 48424 KB Output is correct
54 Correct 42 ms 48320 KB Output is correct
55 Correct 33 ms 48328 KB Output is correct
56 Correct 33 ms 48336 KB Output is correct
57 Correct 32 ms 48284 KB Output is correct
58 Correct 33 ms 48432 KB Output is correct
59 Correct 42 ms 48440 KB Output is correct
60 Correct 32 ms 48304 KB Output is correct
61 Correct 33 ms 48300 KB Output is correct
62 Correct 33 ms 48388 KB Output is correct
63 Correct 38 ms 48304 KB Output is correct
64 Correct 34 ms 48440 KB Output is correct
65 Correct 41 ms 48408 KB Output is correct
66 Correct 33 ms 48336 KB Output is correct
67 Correct 33 ms 48312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4086 ms 48344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2532 ms 47480 KB Output is correct
2 Execution timed out 4019 ms 48328 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 47184 KB Output is correct
2 Correct 21 ms 47220 KB Output is correct
3 Correct 24 ms 47168 KB Output is correct
4 Correct 24 ms 47244 KB Output is correct
5 Correct 24 ms 47276 KB Output is correct
6 Correct 25 ms 47240 KB Output is correct
7 Correct 24 ms 47184 KB Output is correct
8 Correct 30 ms 47168 KB Output is correct
9 Correct 24 ms 47224 KB Output is correct
10 Correct 23 ms 47172 KB Output is correct
11 Correct 24 ms 47188 KB Output is correct
12 Correct 24 ms 47184 KB Output is correct
13 Correct 24 ms 47164 KB Output is correct
14 Correct 24 ms 47184 KB Output is correct
15 Correct 31 ms 47176 KB Output is correct
16 Correct 25 ms 47272 KB Output is correct
17 Correct 24 ms 47228 KB Output is correct
18 Correct 23 ms 47184 KB Output is correct
19 Correct 25 ms 47184 KB Output is correct
20 Correct 24 ms 47184 KB Output is correct
21 Correct 23 ms 47164 KB Output is correct
22 Correct 25 ms 47184 KB Output is correct
23 Correct 25 ms 47212 KB Output is correct
24 Correct 24 ms 47184 KB Output is correct
25 Correct 24 ms 47184 KB Output is correct
26 Correct 24 ms 47188 KB Output is correct
27 Correct 24 ms 47184 KB Output is correct
28 Correct 27 ms 47200 KB Output is correct
29 Correct 24 ms 47164 KB Output is correct
30 Correct 25 ms 47184 KB Output is correct
31 Correct 25 ms 47284 KB Output is correct
32 Correct 24 ms 47192 KB Output is correct
33 Correct 24 ms 47232 KB Output is correct
34 Correct 25 ms 47168 KB Output is correct
35 Correct 24 ms 47184 KB Output is correct
36 Correct 33 ms 47916 KB Output is correct
37 Correct 33 ms 48328 KB Output is correct
38 Correct 32 ms 48336 KB Output is correct
39 Correct 32 ms 48336 KB Output is correct
40 Correct 32 ms 48344 KB Output is correct
41 Correct 34 ms 48372 KB Output is correct
42 Correct 33 ms 48336 KB Output is correct
43 Correct 34 ms 48416 KB Output is correct
44 Correct 38 ms 48328 KB Output is correct
45 Correct 41 ms 48424 KB Output is correct
46 Correct 34 ms 48440 KB Output is correct
47 Correct 33 ms 48440 KB Output is correct
48 Correct 33 ms 48328 KB Output is correct
49 Correct 33 ms 48336 KB Output is correct
50 Correct 32 ms 48420 KB Output is correct
51 Correct 33 ms 48304 KB Output is correct
52 Correct 34 ms 48420 KB Output is correct
53 Correct 33 ms 48424 KB Output is correct
54 Correct 42 ms 48320 KB Output is correct
55 Correct 33 ms 48328 KB Output is correct
56 Correct 33 ms 48336 KB Output is correct
57 Correct 32 ms 48284 KB Output is correct
58 Correct 33 ms 48432 KB Output is correct
59 Correct 42 ms 48440 KB Output is correct
60 Correct 32 ms 48304 KB Output is correct
61 Correct 33 ms 48300 KB Output is correct
62 Correct 33 ms 48388 KB Output is correct
63 Correct 38 ms 48304 KB Output is correct
64 Correct 34 ms 48440 KB Output is correct
65 Correct 41 ms 48408 KB Output is correct
66 Correct 33 ms 48336 KB Output is correct
67 Correct 33 ms 48312 KB Output is correct
68 Execution timed out 4086 ms 48344 KB Time limit exceeded
69 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1379 ms 47904 KB Output is correct
2 Execution timed out 4014 ms 48300 KB Time limit exceeded
3 Halted 0 ms 0 KB -