Submission #1116266

# Submission time Handle Problem Language Result Execution time Memory
1116266 2024-11-21T11:56:28 Z NotLinux MalnaRISC (COI21_malnarisc) C++17
0 / 100
2 ms 848 KB
// Author : FatihCihan
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
int n;
vector < pair < int , int > > ans[20];
void f(int ind , int l , int r){
	if(l == r)return;
	int mid = (l + r) / 2;
	f(ind+1 , l , mid);
	f(ind+1 , mid+1 , r);
	ans[ind].push_back({l , mid+1});
	for(int i = l+1;i<r;i++){
		for(int j = i+1;j<=r;j++){
			ans[ind].push_back({i , j});
		}
	}
}
void solve(){
	cin >> n;
	f(0,1,n);
	int cevap = 0;
	for(int i = 0;i<20;i++)if(sz(ans[i]))cevap++;
	cout << cevap << endl;
	for(int i = 20;i>=0;i--){
		if(sz(ans[i]) == 0)continue;
		for(auto itr : ans[i]){
			cout << "CMPSWP R" << itr.first << " R" << itr.second << " ";
		}
		cout << endl;
	}
}
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int testcase = 1;//cin >> testcase;
	while(testcase--)solve();
	cerr << 1000.0 * clock() / CLOCKS_PER_SEC << " ms" << endl;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 848 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -