Submission #1117511

#TimeUsernameProblemLanguageResultExecution timeMemory
1117511wellthen_Self Study (JOI22_ho_t2)Java
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <climits> using namespace std; typedef long long ll; bool works(ll mid, vector<ll> classes, vector<ll> selfstudy, ll n, ll m){ //satisfy requirement for all the classes ll time = n*m; for(int i = 0; i<classes.size(); i++){ if(classes[i] > selfstudy[i]){ if(m * classes[i] >= mid){ time -= (mid + classes[i] - 1) / classes[i]; } else{ time -= m; time -= (mid - m * classes[i] + selfstudy[i] - 1) / selfstudy[i]; } } else { time -= (mid + selfstudy[i] - 1) / selfstudy[i]; } } return time>=0; } int main() { ll n, m; cin >> n >> m; vector<ll> classes(n), selfstudy(n); for (int i = 0; i < n; i++) { cin >> classes[i]; } for (int i = 0; i < n; i++) { cin >> selfstudy[i]; } ll lo = 0, hi = ll(1e16), best = 0; while (lo <= hi) { ll mid = lo + (hi - lo) / 2; if (works(mid, classes, selfstudy, n, m)) { best = mid; lo = mid + 1; } else { hi = mid - 1; } } cout << best << endl; return 0; }

Compilation message (stderr)

Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
Main.java:2: error: illegal character: '#'
#include <climits>
^
Main.java:4: error: class, interface, or enum expected
typedef long long ll;
^
Main.java:5: error: class, interface, or enum expected
bool works(ll mid, vector<ll> classes, vector<ll> selfstudy, ll n, ll m){
^
Main.java:8: error: class, interface, or enum expected
    for(int i = 0; i<classes.size(); i++){
    ^
Main.java:8: error: class, interface, or enum expected
    for(int i = 0; i<classes.size(); i++){
                   ^
Main.java:8: error: class, interface, or enum expected
    for(int i = 0; i<classes.size(); i++){
                                     ^
Main.java:12: error: class, interface, or enum expected
            }
            ^
Main.java:15: error: class, interface, or enum expected
                time -= (mid - m * classes[i] + selfstudy[i] - 1) / selfstudy[i];
                ^
Main.java:16: error: class, interface, or enum expected
            }
            ^
Main.java:20: error: class, interface, or enum expected
        }
        ^
Main.java:23: error: class, interface, or enum expected
}
^
Main.java:26: error: class, interface, or enum expected
    cin >> n >> m;
    ^
Main.java:27: error: class, interface, or enum expected
    vector<ll> classes(n), selfstudy(n);
    ^
Main.java:28: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
    ^
Main.java:28: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
                    ^
Main.java:28: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
                           ^
Main.java:30: error: class, interface, or enum expected
    }
    ^
Main.java:31: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
                    ^
Main.java:31: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
                           ^
Main.java:33: error: class, interface, or enum expected
    }
    ^
Main.java:35: error: class, interface, or enum expected
    while (lo <= hi) {
    ^
Main.java:37: error: class, interface, or enum expected
        if (works(mid, classes, selfstudy, n, m)) {
        ^
Main.java:39: error: class, interface, or enum expected
            lo = mid + 1;
            ^
Main.java:40: error: class, interface, or enum expected
        } else {
        ^
Main.java:42: error: class, interface, or enum expected
        }
        ^
Main.java:46: error: class, interface, or enum expected
    return 0;
    ^
Main.java:47: error: class, interface, or enum expected
}
^
29 errors