Submission #602007

# Submission time Handle Problem Language Result Execution time Memory
602007 2022-07-22T13:29:09 Z rajatshenoi Knjige (COCI20_knjige) C++14
0 / 50
48 ms 28076 KB
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
	int N; cin >> N;

	vector<int> v(N, 0);
	vector<int> s(N, 0);

	for (int i = 0; i < N; i++) {
		cin >> v[i];
		s[i] = v[i];
	}

	sort(s.begin(), s.end());

	int count = 0;
	vector<vector<int>> moves;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < v.size(); j++) {
			if (v[j] == s[i]) {
				vector<int> temp(3, 0);
				temp[0] = 0;
				temp[1] = 1;
				temp[2] = 0;
				moves.push_back(temp);
				count++;

				for (int k = 0; k < j; k++) {
					vector<int> temp(3, 0);
					temp[0] = 0;
					temp[1] = 0;
					temp[2] = 1;
					moves.push_back(temp);
					count++;

					temp[0] = 1;
					temp[1] = 0;
					temp[2] = 0;
					moves.push_back(temp);
					count++;
				}
			} else {
				vector<int> temp(3, 0);
				temp[0] = 0;
				temp[1] = 0;
				temp[2] = 0;
				moves.push_back(temp);
				count++;

				temp[0] = 1;
				temp[1] = 0;
				temp[2] = 1;
				moves.push_back(temp);
				count++;
			}
		}
	}

	for (int i = 0; i < N; i++) {
		vector<int> temp(3, 0);
		temp[0] = 0;
		temp[1] = 0;
		temp[2] = 1;
		moves.push_back(temp);
		count++;

		temp[0] = 1;
		temp[1] = 0;
		temp[2] = 0;
		moves.push_back(temp);
		count++;
	}

	cout << count << endl;

	for (int i = 0; i < N; i++) {
		if (moves[i][0] == 0)
			cout << "UZMI ";
		else
			cout << "STAVI ";

		if (moves[i][1] == 0)
			cout << "L ";
		else
			cout << "D ";

		if (moves[i][2] == 0)
			cout << "L" << endl;
		else
			cout << "D" << endl;
	}

	return 0;
}

Compilation message

Main.cpp: In function 'int main(int, const char**)':
Main.cpp:23:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for (int j = 0; j < v.size(); j++) {
      |                   ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 7056 KB Integer parameter [name=k] equals to 123502, violates the range [0, 100000]
2 Incorrect 7 ms 3080 KB Unexpected end of file - token expected
3 Incorrect 4 ms 2828 KB Unexpected end of file - token expected
4 Incorrect 4 ms 2060 KB Unexpected end of file - token expected
5 Incorrect 4 ms 1932 KB Unexpected end of file - token expected
6 Incorrect 4 ms 2792 KB Unexpected end of file - token expected
7 Incorrect 48 ms 28076 KB Integer parameter [name=k] equals to 507952, violates the range [0, 100000]
8 Incorrect 3 ms 1932 KB Unexpected end of file - token expected
9 Incorrect 4 ms 2060 KB Unexpected end of file - token expected
10 Incorrect 5 ms 2828 KB Unexpected end of file - token expected