Submission #1174253

#TimeUsernameProblemLanguageResultExecution timeMemory
1174253manuelalejandroSelf Study (JOI22_ho_t2)C++20
0 / 100
0 ms472 KiB
#include <bits/stdc++.h> #define int long long #define pb push_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define tam(x) (int)(x).size() #define endl '\n' #define sd second #define fs first #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define optmizar_io ios_base::sync_with_stdio(0); cin.tie(0); #define Setpre(n) cout << fixed <<setprecision(n) #define dbg(x) for(auto y: x) cout << y <<' '; cout << endl; #define dbg1(x) for(auto y: x) cout << y.first <<' '<< y.second << endl; #define dbg2(v) for(auto x: v) cout << x.a<< ' '<< x.b <<' '<< x.c << endl; const int MAX = 501; const int INF = 1e9; const int Mod = 1e9+7; const int zero = 0; const double eps = 1e-6; const double PI=acos(-1.0); const int mox[8] ={-1,1,0,0,-1,-1,1,1}; const int moy[8] ={0,0,-1,1,-1,1,-1,1}; using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pi; typedef vector<bool> vbol; typedef array<int, 3> arr; void cases(string s){ #ifndef ONLINE_JUDGE if(tam(s) == 0) s = "1"; string a = s + ".in"; string b = s + ".out"; freopen(a.c_str(), "r", stdin); freopen(b.c_str(), "w", stdout); #endif } void _1() { int n, m; cin >> n >> m; vi ar1(n), ar2(n); for(int &x : ar1) cin >> x; for(int &x : ar2) cin >> x; sort(rall(ar1)); priority_queue<int, vi, greater<int> > pq; for(int i = 0; i < n; i++) pq.push(0); for(int j = 0; j < m; j++) { for(int i = 0; i < n; i++) { int a = pq.top(); pq.pop(); pq.push(a + ar1[i]); } } int mini = INF; while(tam(pq)) { //cout << pq.top() << " "; mins(mini, pq.top()); pq.pop(); } cout << mini << endl; } int32_t main() { optmizar_io // cases(""); //start: //end: //tags: //difficulty: //comment: int T = 1; //cin >> T; while(T--) _1(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'void cases(std::string)':
Main.cpp:42:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |     freopen(a.c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:43:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   43 |     freopen(b.c_str(), "w",  stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...