답안 #1040833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040833 2024-08-01T10:18:00 Z nightfal 식물 비교 (IOI20_plants) C++14
5 / 100
50 ms 8800 KB
#include "plants.h"
static std:: vector<int> inc,dec;
 
void init(int k, std::vector<int> r) {
    int n = r.size();
	if(k==2) {
      inc.resize(n); dec.resize(n);
      for(int i=0; i<n; i++) {inc[i] = dec[i] = i;}
      int s,incVal,decVal;
      for(s=2*n-1; s>=0; s--) {
        if (r[s%n]==0) incVal = s;
        else decVal = s;
        inc[s%n] = incVal; dec[s%n] = decVal;
      }
    }
	return;
}
int subtask1(int x, int y) {
    int n = inc.size();
    if (y <= dec[x] or x+n <= inc[y]) return 1;
    else if (y <= inc[x] or x+n <= dec[y]) return -1;
	return 0;
}
int compare_plants(int x, int y) {
  	return subtask1(x,y);
	return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:13:37: warning: 'decVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |         inc[s%n] = incVal; dec[s%n] = decVal;
plants.cpp:13:18: warning: 'incVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 |         inc[s%n] = incVal; dec[s%n] = decVal;
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 28 ms 4180 KB Output is correct
7 Correct 35 ms 5712 KB Output is correct
8 Correct 42 ms 8784 KB Output is correct
9 Correct 50 ms 8784 KB Output is correct
10 Correct 40 ms 8800 KB Output is correct
11 Correct 41 ms 8784 KB Output is correct
12 Correct 42 ms 8652 KB Output is correct
13 Correct 38 ms 8788 KB Output is correct
14 Correct 40 ms 8664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 0 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 0 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 0 ms 348 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Runtime error 0 ms 348 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Runtime error 1 ms 344 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 28 ms 4180 KB Output is correct
7 Correct 35 ms 5712 KB Output is correct
8 Correct 42 ms 8784 KB Output is correct
9 Correct 50 ms 8784 KB Output is correct
10 Correct 40 ms 8800 KB Output is correct
11 Correct 41 ms 8784 KB Output is correct
12 Correct 42 ms 8652 KB Output is correct
13 Correct 38 ms 8788 KB Output is correct
14 Correct 40 ms 8664 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Runtime error 0 ms 348 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -