Submission #1006458

# Submission time Handle Problem Language Result Execution time Memory
1006458 2024-06-24T02:28:47 Z vjudge1 Knjige (COCI20_knjige) C++17
0 / 50
37 ms 1492 KB
#include<bits/stdc++.h>

using namespace std;

const int N = 105;
vector<int> a;
string space = " ", take = "UZMI", put = "STAVI", lft = "L", rht = "D";
vector<string> sol;
int n;

void SORT(vector<int> v)
{
  // cerr << v.size() << endl;
  if(v.size() <= 1) return;
  
  vector<int> vp;
  int l = v.back();
  for(int j = v.size() - 2; j >= 0; j--)
    {
      sol.push_back(take + space + rht + space + rht);
      int r = a[j];

      if(l > r)
	{
	  vp.push_back(l);
	  sol.push_back(put + space + lft + space + lft);
	  sol.push_back(put + space + rht + space + lft);
	  sol.push_back(take + space + lft + space + lft);
	  l = r;
	}
      else
	{
	  vp.push_back(r);
	  sol.push_back(put + space + rht + space + lft);
	}
    }

  for(int i = 0; i < vp.size(); i++)
    {
      sol.push_back(take + space + rht + space + lft);
      sol.push_back(put + space + rht + space + rht);
    }

  sol.push_back(put + space + lft + space + lft);
  SORT(vp);
  
}

int main()
{
  cin >> n;
  a.resize(n);
  for(int i = 0; i < n; i ++)
    cin >> a[i];

  for(int i = 0; i < n; i ++)
    {
      sol.push_back(take);
      sol.back() += space + lft + space + lft;

      sol.push_back(put);
      sol.back() += space +  lft + space +  rht;
    }
  
  SORT(a);
  cout << sol.size() << endl;
  for(auto s : sol)
    cout << s << endl;
  return 0;
}

Compilation message

Main.cpp: In function 'void SORT(std::vector<int>)':
Main.cpp:38:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   for(int i = 0; i < vp.size(); i++)
      |                  ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1492 KB Cannot put a book with empty hand
2 Incorrect 22 ms 1492 KB Cannot put a book with empty hand
3 Incorrect 37 ms 1488 KB Cannot put a book with empty hand
4 Incorrect 21 ms 1492 KB Cannot put a book with empty hand
5 Incorrect 22 ms 1492 KB Cannot put a book with empty hand
6 Incorrect 20 ms 1492 KB Cannot put a book with empty hand
7 Incorrect 18 ms 1488 KB Cannot put a book with empty hand
8 Incorrect 29 ms 1492 KB Cannot put a book with empty hand
9 Incorrect 23 ms 1492 KB Cannot put a book with empty hand
10 Incorrect 22 ms 1492 KB Cannot put a book with empty hand