제출 #815959

#제출 시각아이디문제언어결과실행 시간메모리
815959vjudge1Self Study (JOI22_ho_t2)C++17
35 / 100
54 ms6864 KiB
#include <bits/stdc++.h> #define int long long using namespace std; void open(){ if(fopen("input.inp", "r")){ freopen("input.inp", "r", stdin); //freopen("output.out", "w", stdout); } } const int maxn = 3e5 + 5; int n, m; int A[maxn], B[maxn]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); open(); cin >> n >> m; for(int i = 1; i <= n; i++){ cin >> A[i]; } for(int i = 1; i <= n; i++){ cin >> B[i]; } if(m == 1){ int result = 1e9 + 7; for(int i = 1; i <= n; i++){ result = min(result, max(A[i], B[i])); } cout << result << endl; return 0; } if(m * n <= maxn){ priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq; for(int i = 1; i <= n; i++){ pq.push({0, i}); } while(m--){ int temp = n; vector<bool> check(n + 1, false); while(temp--){ pair<int, int> first = pq.top(); pq.pop(); int old_val = first.first; int pos = first.second; if(A[pos] > B[pos] && !check[pos]){ check[pos] = true; old_val += A[pos]; }else{ old_val += B[pos]; } pq.push({old_val, pos}); } } cout << pq.top().first << endl; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void open()':
Main.cpp:8:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   freopen("input.inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...