Submission #1340692

#TimeUsernameProblemLanguageResultExecution timeMemory
1340692uranhishigLightning Rod (NOI18_lightningrod)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    if (n == 2) {
        if((abs(x[i] - x[j])) < y[i] - y[j]) {
            cout << 1;
            return 0;
        }
        if((abs(x[i] - x[j])) <  - y[i] + y[j]) {
            cout << 1;
            return 0;
        }
        cout << 2;
        return 0;
    }
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:14:19: error: 'i' was not declared in this scope
   14 |         if((abs(x[i] - x[j])) < y[i] - y[j]) {
      |                   ^
Main.cpp:14:26: error: 'j' was not declared in this scope
   14 |         if((abs(x[i] - x[j])) < y[i] - y[j]) {
      |                          ^
Main.cpp:18:19: error: 'i' was not declared in this scope
   18 |         if((abs(x[i] - x[j])) <  - y[i] + y[j]) {
      |                   ^
Main.cpp:18:26: error: 'j' was not declared in this scope
   18 |         if((abs(x[i] - x[j])) <  - y[i] + y[j]) {
      |                          ^