Submission #82062

#TimeUsernameProblemLanguageResultExecution timeMemory
82062heonTavan (COCI16_tavan)C++11
0 / 80
4 ms708 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n,m,k,x; cin >> n >> m >> k >> x; string s; cin >> s; vector <string> v(m); for(int i = 0; i < m; i++){ cin >> v[i]; sort(v[i].begin(), v[i].end()); } long long curr = 0; int ind = 0; vector <char> rj; for(int i = 0; i < m; i++){ while(curr < x){ curr += max(1 ,(m - i - 1) * k); if(curr >= x){ rj.push_back(v[i][ind]); ind = 0; } else ind++; } curr -= (m - i - 1) * k; } for(auto x : s) (x == '#') ? cout << rj[ind++] : cout << x; }

Compilation message (stderr)

tavan.cpp: In function 'int main()':
tavan.cpp:11:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
      freopen("input.txt", "r", stdin);
      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
tavan.cpp:12:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
      freopen("output.txt", "w", stdout);
      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...