Submission #302857

#TimeUsernameProblemLanguageResultExecution timeMemory
302857BasilhijazComparing Plants (IOI20_plants)Java
Compilation error
0 ms0 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; vector<int> pre(2000005); int n; int cnt = 0; void init(int k, std::vector<int> r) { n = r.size(); for(int i = 0; i < n; i++){ pre[i + 1] = pre[i] + r[i]; cnt += r[i]; } return; } int compare_plants(int x, int y) { if(pre[y] - pre[x] == y - x){ return -1; } if(pre[y] - pre[x] == 0){ return 1; } if (cnt - (pre[y] - pre[x]) == n - (y - x)){ return 1; } else if (cnt - (pre[y] - pre[x]) == 0){ return -1; } return 0; }

Compilation message (stderr)

plants.java:1: error: illegal character: '#'
#include "plants.h"
^
plants.java:1: error: class, interface, or enum expected
#include "plants.h"
         ^
plants.java:2: error: illegal character: '#'
#include <bits/stdc++.h>
^
plants.java:5: error: class, interface, or enum expected
vector<int> pre(2000005);
^
plants.java:6: error: class, interface, or enum expected
int n;
^
plants.java:7: error: class, interface, or enum expected
int cnt = 0;
^
plants.java:8: error: class, interface, or enum expected
void init(int k, std::vector<int> r) {
^
plants.java:10: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
    ^
plants.java:10: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                   ^
plants.java:10: error: class, interface, or enum expected
    for(int i = 0; i < n; i++){
                          ^
plants.java:12: error: class, interface, or enum expected
        cnt += r[i];
        ^
plants.java:13: error: class, interface, or enum expected
    }
    ^
plants.java:15: error: class, interface, or enum expected
}
^
plants.java:20: error: class, interface, or enum expected
    }
    ^
plants.java:23: error: class, interface, or enum expected
    }
    ^
plants.java:26: error: class, interface, or enum expected
    }
    ^
plants.java:29: error: class, interface, or enum expected
    }
    ^
plants.java:31: error: class, interface, or enum expected
}
^
18 errors