답안 #303255

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
303255 2020-09-20T06:29:32 Z Kevin_Zhang_TW 식물 비교 (IOI20_plants) C++17
0 / 100
2 ms 512 KB
#include "plants.h"

#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
#ifdef KEV
#define DE(a, b) cerr << #a << ' ' << a << b
void debug(auto L, auto R) { while (L != R) cerr << *L << " \n"[L+1==R], ++L; }
#else
#define DE(...) 0
void debug(...) {}
#endif
const int maxn = 300010;

int nxt[maxn], n, r[maxn], k;
int F(int i) { return i % n; }
void init(int k, std::vector<int> r) {
    ::k = k;
	n = r.size();
    copy(r.begin(), r.end(), ::r);
	return;
}
int compare_plants(int x, int y) {
    assert(k == 2);
    if (F(x+1) == y) 
        return (r[x] ? -1 : 1);

    if (F(y+1) == x) 
        return (r[y] ? 1 : -1);

	return 0;
}

Compilation message

plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:29:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   29 |     if (F(y+1) == x)
      |     ^~
plants.cpp:32:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   32 |  return 0;
      |  ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Incorrect 0 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Runtime error 2 ms 512 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Runtime error 2 ms 512 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 288 KB Output is correct
2 Runtime error 1 ms 512 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Incorrect 0 ms 384 KB Output isn't correct
6 Halted 0 ms 0 KB -