Submission #474089

# Submission time Handle Problem Language Result Execution time Memory
474089 2021-09-16T21:12:50 Z CaroLinda Knjige (COCI20_knjige) C++14
0 / 50
6 ms 3660 KB
#include <bits/stdc++.h>

#define sz(x) (int)(x.size())
#define debug printf
#define lp(i,a,b) for(int i = a ; i < b; i++)
#define pb push_back
#define ff first
#define ss second
#define mk make_pair
#define pii pair<int,int>
#define ll long long 
#define all(x) x.begin(),x.end()
 
const int MAXN = 1e5+10 ;
 
using namespace std ;
 
int N ;
vector<int> vec ;
vector<string> a ,b , c ;

int main()
{
	cin >> N ;
	for(int i = 1 , x ; i <= N ; i++ ) 
	{
		cin >> x ;
		vec.push_back(x) ;
	}
	
	for(int i = 1 , j = N ; i < N ; i++ , j-- )
	{
		int k ;
		for(int kk = 0 ; kk < sz(vec) ; kk++ )
		{
			if(vec[kk] == j) 
			{
				k = kk ;
				a.pb("UZMI") ;	
				b.pb("D") ;
				c.pb("L") ;
				continue ;
			}
			a.pb("UZMI") ;
			a.pb( "STAVI" ) ;
			b.pb("L") ;
			b.pb("L") ;
			c.pb( "L" ) ;
			c.pb("D") ;
		}
			
		vector<int> lef( vec.begin() , vec.begin()+k ) ;
		vector<int> rig( vec.begin()+k+1 , vec.end() ) ;
	
		a.pb( "STAVI" ) ;
		b.pb("D") ;
		c.pb("L") ;
		
		vec.clear() ;
		vec.insert(vec.begin() , lef.begin() , lef.end() ) ;
		vec.insert( vec.end() , rig.begin() , rig.end() ) ;
		
		for(auto e : vec ) 
		{
			a.pb("UZMI") ;
			a.pb( "STAVI" ) ;
			b.pb("L") ;
			b.pb("L") ;
			c.pb( "D" ) ;
			c.pb("L") ;
		}
				
	}
	
	cout << sz(a)  << endl ;
	for(int i = 0 ; i < sz(a) ; i++ )
	{
		cout << a[i] << " " << b[i] << " " << c[i] << endl ;
	}
	
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:64:12: warning: unused variable 'e' [-Wunused-variable]
   64 |   for(auto e : vec )
      |            ^
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 588 KB Execution killed with signal 6
2 Runtime error 3 ms 588 KB Execution killed with signal 6
3 Runtime error 6 ms 3660 KB Execution killed with signal 6
4 Runtime error 3 ms 588 KB Execution killed with signal 6
5 Runtime error 3 ms 588 KB Execution killed with signal 6
6 Runtime error 3 ms 588 KB Execution killed with signal 6
7 Runtime error 3 ms 588 KB Execution killed with signal 6
8 Runtime error 3 ms 588 KB Execution killed with signal 6
9 Runtime error 3 ms 588 KB Execution killed with signal 6
10 Runtime error 4 ms 2252 KB Execution killed with signal 6