Submission #420641

# Submission time Handle Problem Language Result Execution time Memory
420641 2021-06-08T13:04:34 Z Berted MalnaRISC (COI21_malnarisc) C++14
76.4122 / 100
2 ms 332 KB
#include <iostream>
#include <vector>
#define vi vector<int>
#define pii pair<int, int>
#define fst first
#define snd second
#define vpi vector<pii>


using namespace std;

int N;
vector<vpi> ans;

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		ans.push_back(vpi());
		for (int j = i % 2 + 1; j + 1 <= N; j += 2)
		{
			ans.back().push_back({j, j + 1});
		}
	}

	cout << ans.size() << "\n";
	for (auto &V : ans)
	{
		for (int i = 0; i < V.size(); i++)
		{
			//if (V[i].fst > V[i].snd) swap(V[i].fst, V[i].snd);
			cout << "CMPSWP R" << V[i].fst << " R" << V[i].snd << " \n"[i + 1 == V.size()];
		}
	}
	return 0;
}

Compilation message

malnarisc.cpp: In function 'int main()':
malnarisc.cpp:30:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for (int i = 0; i < V.size(); i++)
      |                   ~~^~~~~~~~~~
malnarisc.cpp:33:70: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    cout << "CMPSWP R" << V[i].fst << " R" << V[i].snd << " \n"[i + 1 == V.size()];
      |                                                                ~~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 204 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 332 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 332 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 332 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 332 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 332 KB Partially correct