Submission #1002680

# Submission time Handle Problem Language Result Execution time Memory
1002680 2024-06-19T18:04:27 Z Lobo MalnaRISC (COI21_malnarisc) C++17
0 / 100
1 ms 600 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back

int main() {
	#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
	#endif

	int n; cin >> n;
	vector<string> lines;
	for(int it = 0; it < n-it; it++) {
		for(int i = 0; i < 7; i++) {
			lines.pb("");
			vector<int> ids;
			for(int x = it; x < n-it; x++) ids.pb(x);
			for(int j = 0; j+(1<<i) < ids.size(); j++) {
				if((j/(1<<i))%2 == 1) continue;
				int y = ids[j];
				int x = ids[j+(1<<i)];
				lines.back() += ("CMPSWP R"+to_string(y+1)+" R"+to_string(x+1)+" ");
			}
			// for(int x = it; x < n-it; x++) {
			// 	int y = (x^(1<<i));
			// 	if(y > x) continue;
			// 	lines.back() += ("CMPSWP R"+to_string(y+1)+" R"+to_string(x+1)+" ");
			// }
			if(lines.back().size() == 0) lines.pop_back();
			else lines.back().pop_back();
		}
	}

	vector<string> ans = lines;
	// for(int s = 0; s < n; s++) {
	// 	for(int i = s-s; i < s-s+lines.size(); i++) {
	// 		ans.pb(lines[i%(int) lines.size()]);
	// 	}
	// }

	cout << ans.size() << endl;
	for(auto x : ans) {
		cout << x << endl;
	}
}

Compilation message

malnarisc.cpp: In function 'int main()':
malnarisc.cpp:18:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |    for(int j = 0; j+(1<<i) < ids.size(); j++) {
      |                   ~~~~~~~~~^~~~~~~~~~~~
malnarisc.cpp:7:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  freopen("in.in","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~
malnarisc.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  freopen("out.out","w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -