답안 #1014558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1014558 2024-07-05T06:53:19 Z Error404 Kitchen (BOI19_kitchen) C++17
0 / 100
2 ms 2652 KB
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define f first
#define s second
#define pi pair<ll,ll>
#define vi vector<ll>
#define vd vector<double>
#define vpi vector<pi>
#define pb push_back
#define INF 1e18
#define endl '\n'
//#define int ll
#define pii pair<pi,ll>



const int mod = 1e9+7;
const int MAX = 1e5+1;
const int LOG = 30;
vi g[MAX];
int tin[MAX], val[MAX], tout[MAX];
int up[LOG+1][MAX];
map<pi,int>mp;
vector<pi>order;
int timer = 0;


signed main(){
    int n,m,k,a,b;
    cin >>n >> m >> k;
    int dish[n+1], chef[m+1];

    for(int i= 1; i<= n; i++){
        cin >> dish[i];
    }
    multiset<int>st;
    for(int i = 1; i <=m; i++){
        cin >> chef[i];
        st.insert(chef[i]);
    }

    ll ans = 0;
    bool flag = false;

    for(int i = n; i >=1; i--){
        auto j = st.lower_bound(dish[i]);
        if(j==st.end()) {
            cout << "Impossible"<<endl;
            return 0;
        }

        ans += (*j)-dish[i];
      
        // st.erase(j);
        
    }
    cout << ans << endl;

}     

Compilation message

kitchen.cpp: In function 'int main()':
kitchen.cpp:30:15: warning: unused variable 'a' [-Wunused-variable]
   30 |     int n,m,k,a,b;
      |               ^
kitchen.cpp:30:17: warning: unused variable 'b' [-Wunused-variable]
   30 |     int n,m,k,a,b;
      |                 ^
kitchen.cpp:44:10: warning: unused variable 'flag' [-Wunused-variable]
   44 |     bool flag = false;
      |          ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -