Submission #1176392

#TimeUsernameProblemLanguageResultExecution timeMemory
1176392somefolkComparing Plants (IOI20_plants)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <complex>
#include <list>
#include <cassert>
#include <chrono>
#include <random>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define endl "\n"
// #define int long long

const int INF = 1e9+7;
const int MOD = 1e9+7;

void init(int k, vector<int> r){
    int n = r.size();
    k--;
}

int compare_plants(int x, int y){
    if(abs(x-y) > 1) return 0;
    else if(x < y) cout << (r[x] ? -1 : 1) << endl;
    else cout << (r[y] ? 1 : -1) << endl;
}

Compilation message (stderr)

plants.cpp: In function 'int compare_plants(int, int)':
plants.cpp:34:29: error: 'r' was not declared in this scope
   34 |     else if(x < y) cout << (r[x] ? -1 : 1) << endl;
      |                             ^
plants.cpp:35:19: error: 'r' was not declared in this scope
   35 |     else cout << (r[y] ? 1 : -1) << endl;
      |                   ^
plants.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^