Submission #1188271

#TimeUsernameProblemLanguageResultExecution timeMemory
1188271SmuggingSpunKnjige (COCI20_knjige)C++20
0 / 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("STAVI D D");
		}
	}
	cout << ans.size() << "\n";
	for(string& x : ans){
		cout << x << "\n";
	}
}

Compilation message (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...