제출 #1117505

#제출 시각아이디문제언어결과실행 시간메모리
1117505wellthen_Self Study (JOI22_ho_t2)Java
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> 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 = LONG_LONG_MAX; while(lo+1<hi){ ll mid = (lo+hi)/2; if(works(mid, classes, selfstudy, n, m)){ lo = mid; } else{ hi = mid-1; } } if(works(hi, classes, selfstudy, n, m)){ cout << hi << endl; return 0; } cout << lo << endl; }

컴파일 시 표준 에러 (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:3: error: class, interface, or enum expected
typedef long long ll;
^
Main.java:4: error: class, interface, or enum expected
bool works(ll mid, vector<ll> classes, vector<ll> selfstudy, ll n, ll m){
^
Main.java:7: error: class, interface, or enum expected
    for(int i = 0; i<classes.size(); i++){
    ^
Main.java:7: error: class, interface, or enum expected
    for(int i = 0; i<classes.size(); i++){
                   ^
Main.java:7: error: class, interface, or enum expected
    for(int i = 0; i<classes.size(); i++){
                                     ^
Main.java:11: error: class, interface, or enum expected
            }
            ^
Main.java:14: error: class, interface, or enum expected
                time -= (mid - m * classes[i] + selfstudy[i] - 1) / selfstudy[i];
                ^
Main.java:15: error: class, interface, or enum expected
            }
            ^
Main.java:19: error: class, interface, or enum expected
        }
        ^
Main.java:22: error: class, interface, or enum expected
}
^
Main.java:25: error: class, interface, or enum expected
    cin >> n >> m;
    ^
Main.java:26: error: class, interface, or enum expected
    vector<ll> classes(n), selfstudy(n);
    ^
Main.java:27: error: class, interface, or enum expected
    for(int i = 0; i<n; i++){
    ^
Main.java:27: error: class, interface, or enum expected
    for(int i = 0; i<n; i++){
                   ^
Main.java:27: error: class, interface, or enum expected
    for(int i = 0; i<n; i++){
                        ^
Main.java:29: error: class, interface, or enum expected
    }
    ^
Main.java:30: error: class, interface, or enum expected
    for(int i = 0; i<n; i++){
                   ^
Main.java:30: error: class, interface, or enum expected
    for(int i = 0; i<n; i++){
                        ^
Main.java:32: error: class, interface, or enum expected
    }
    ^
Main.java:34: error: class, interface, or enum expected
    while(lo+1<hi){
    ^
Main.java:36: error: class, interface, or enum expected
        if(works(mid, classes, selfstudy, n, m)){
        ^
Main.java:38: error: class, interface, or enum expected
        }
        ^
Main.java:41: error: class, interface, or enum expected
        }
        ^
Main.java:45: error: class, interface, or enum expected
        return 0;
        ^
Main.java:46: error: class, interface, or enum expected
    }
    ^
Main.java:48: error: class, interface, or enum expected
}
^
28 errors