Code Submission Evaluation System Login

Datatähti 2016 alku

Start:2015-09-28 00:00:00
End:2015-10-12 00:00:00
 

Tasks | Scoreboard | Statistics


CSES - Datatähti 2016 alku - Results
History
2015-10-10 13:13:23100
2015-10-05 21:29:440
2015-10-05 21:02:130
2015-10-05 21:00:500
2015-10-05 20:52:540
2015-10-05 20:50:540
2015-10-05 20:49:49
2015-10-05 20:49:23
2015-10-05 20:47:41
2015-10-05 20:44:47
2015-10-05 20:43:090
2015-10-05 20:27:140
2015-10-05 20:19:230
2015-10-05 20:00:120
2015-10-05 19:30:100
2015-10-05 19:29:210
2015-10-05 19:26:000
2015-10-05 19:17:540
2015-10-05 19:17:000
2015-10-05 19:15:240
2015-10-05 19:13:360
2015-10-05 19:10:51
2015-10-05 19:05:300
2015-10-05 19:00:150
2015-10-05 18:56:350
2015-10-05 18:18:460
2015-10-05 18:16:440
2015-10-05 18:09:300
2015-10-05 18:08:28
2015-10-05 18:07:55
2015-10-05 18:06:41
2015-10-05 18:04:44
Task:Kirjat
Sender:hugo-hur
Submission time:2015-10-05 20:49:23
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:46:10: error: 'e' does not name a type
   catch (e){
          ^

Code

#include <iostream>
#include <string>
#include <vector>
#include <exception>
#include <stdio.h>
//using namespace std;

inline void readToArray(unsigned int n, unsigned int* ptr){
	for (unsigned int i = 0; i < n; i++){
		std::cin >> ptr[i];
	}
}
int main() {
	std::cin.sync_with_stdio(false);//Faster execution
	unsigned int n = 0;
	std::cin >> n;
	unsigned int* uolevinJarjestys = new unsigned int[n];
	unsigned int* maijanJarjestys = new unsigned int[n];
	readToArray(n, uolevinJarjestys);
	readToArray(n, maijanJarjestys);

	/*unsigned long* num = new unsigned long[n];
	for (unsigned long i = 0; i<n; i++){
		num[i] = 0;
	}*/
	std::vector < unsigned int >toTry;
	for (unsigned int i = 1; i <= n; i++){
		toTry.push_back(i);
	}
	//Etsi lukujono, joka on välillä 0<num[x]<n && num[x] != uolevinJärjestys[x] && num[x] != maijanJärjestys[x]
	for (unsigned long i = 0; i < n; i++){
		unsigned long z = 0;
		
		//if(toTry.size() == 0){break;}
		unsigned int x = toTry.at(z);
		
		while (x == uolevinJarjestys[i] || x == maijanJarjestys[i]){
			z++;
			//toTry.pop_front();
			x = toTry.at(z);
		}
		//Remove used entry from the list
		try{
			toTry.erase(toTry.begin() + z);
		}
		catch (e){
			//std::cout << "Exception: " << e.what() << std::endl;
		}
		
		//num[i] = x;
		std::cout << x << ' ';
	}
	std::cout << std::endl;
	
	return 0;
}