# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
786071 | 2023-07-18T02:31:40 Z | makanhulia | Exhibition (JOI19_ho_t2) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back typedef pair<ll,ll> pairz; const int N = 1e3+5; ll tc = 1; vector<pairz> vec; vector<ll> bing; bool visited[N]; ll n, m, s, v, a; bool cmp(pairz a, pairz b){ return a.second < b.second; } void pameran(){ // a.second -> harga // a.first -> size sort(vec.begin(), vec.end(), cmp); ll curweight = 0, curprice = 0, ans = 0;; for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ if(vec[j].first > bing[i]) continue; if(curprice < vec[j].second && visited[j] == false){ curprice = vec[j].second; ans++; visited[j] = true; break; } else continue; } } cout << ans << endl; } void input(){ cin >> n >> m; for(int i=0;i<n;i++){ cin >> s >> v; vec.pb(make_pair(s,v)); visited[vec.size()-1] = false; } for(int i=0;i<m;i++){ cin >> a; bing.pb(a); } pameran(); } int main() { // cin >> tc; while(tc--) input(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |