제출 #1275233

#제출 시각아이디문제언어결과실행 시간메모리
1275233SmuggingSpunZigZag (COCI17_zigzag)C++20
80 / 80
62 ms6892 KiB
#include<bits/stdc++.h> #define taskname "B" using namespace std; priority_queue<pair<int, string>, vector<pair<int, string>>, greater<pair<int, string>>>pq[26]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } int k, n; cin >> k >> n; for(int i = 0; i < k; i++){ string s; cin >> s; pq[s[0] - 'a'].emplace(0, s); } for(int i = 0; i < n; i++){ char c; cin >> c; pair<int, string>s = pq[c -= 'a'].top(); pq[c].pop(); pq[c].emplace(s.first + 1, s.second); cout << s.second << "\n"; } }

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

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