답안 #303257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
303257 2020-09-20T06:35:19 Z Kevin_Zhang_TW 식물 비교 (IOI20_plants) C++17
컴파일 오류
0 ms 0 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;
set<pair<int,int>> win;
int F(int i) { return i % n; }
void init(int k, std::vector<int> r) {
    ::k = k;
	n = r.size();
    for (int i = 0;i < n;++i)
        win.insert( r[i]? {F(i+1), i} : {i, F(i+1)});
	return;
}
int compare_plants(int x, int y) {
    if (win.count({x, y}))
        return 1;
    if (win.count({y, x}))
        return -1;
	return 0;
}

Compilation message

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:23:27: error: expected primary-expression before '{' token
   23 |         win.insert( r[i]? {F(i+1), i} : {i, F(i+1)});
      |                           ^
plants.cpp:23:26: error: expected ':' before '{' token
   23 |         win.insert( r[i]? {F(i+1), i} : {i, F(i+1)});
      |                          ^~
      |                          :
plants.cpp:23:27: error: expected primary-expression before '{' token
   23 |         win.insert( r[i]? {F(i+1), i} : {i, F(i+1)});
      |                           ^
plants.cpp:22:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   22 |     for (int i = 0;i < n;++i)
      |     ^~~
plants.cpp:24:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   24 |  return;
      |  ^~~~~~
plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:29:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   29 |     if (win.count({y, x}))
      |     ^~
plants.cpp:31:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   31 |  return 0;
      |  ^~~~~~