Submission #1040836

# Submission time Handle Problem Language Result Execution time Memory
1040836 2024-08-01T10:24:09 Z nightfal Comparing Plants (IOI20_plants) C++17
5 / 100
44 ms 5868 KB
#include "plants.h"
static std:: vector<int> inc,dec;
static int l;
 
void init(int k, std::vector<int> r) {
    int n = r.size(); l=k;
	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) {
  	if (l==2) return subtask1(x,y);
	return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:14:37: warning: 'decVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
   14 |         inc[s%n] = incVal; dec[s%n] = decVal;
plants.cpp:14:18: warning: 'incVal' may be used uninitialized in this function [-Wmaybe-uninitialized]
   14 |         inc[s%n] = incVal; dec[s%n] = decVal;
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 24 ms 3164 KB Output is correct
7 Correct 28 ms 3380 KB Output is correct
8 Correct 40 ms 5716 KB Output is correct
9 Correct 39 ms 5724 KB Output is correct
10 Correct 44 ms 5724 KB Output is correct
11 Correct 37 ms 5868 KB Output is correct
12 Correct 38 ms 5724 KB Output is correct
13 Correct 36 ms 5724 KB Output is correct
14 Correct 37 ms 5716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 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 24 ms 3164 KB Output is correct
7 Correct 28 ms 3380 KB Output is correct
8 Correct 40 ms 5716 KB Output is correct
9 Correct 39 ms 5724 KB Output is correct
10 Correct 44 ms 5724 KB Output is correct
11 Correct 37 ms 5868 KB Output is correct
12 Correct 38 ms 5724 KB Output is correct
13 Correct 36 ms 5724 KB Output is correct
14 Correct 37 ms 5716 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Incorrect 0 ms 348 KB Output isn't correct
18 Halted 0 ms 0 KB -