제출 #1188274

#제출 시각아이디문제언어결과실행 시간메모리
1188274SmuggingSpunKnjige (COCI20_knjige)C++20
50 / 50
1 ms968 KiB
#include<bits/stdc++.h> #define taskname "A" using namespace std; 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 n; cin >> n; vector<int>a; vector<string>ans; for(int i = 0; i < n; i++){ int x, cnt = 0; cin >> x; ans.emplace_back("UZMI L L"); a.emplace_back(x); for(int j = int(a.size()) - 1; j > 0 && a[j] < a[j - 1]; j--, cnt++){ swap(a[j], a[j - 1]); ans.emplace_back("UZMI D D"); ans.emplace_back("STAVI D L"); } ans.emplace_back("STAVI L D"); for(int _ = 0; _ < cnt; _++){ ans.emplace_back("UZMI D L"); ans.emplace_back("STAVI D D"); } } for(int i = 0; i < n; i++){ ans.emplace_back("UZMI D D"); ans.emplace_back("STAVI D L"); } cout << ans.size() << "\n"; for(string& x : ans){ cout << x << "\n"; } }

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

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