Submission #200772

# Submission time Handle Problem Language Result Execution time Memory
200772 2020-02-08T06:34:00 Z mohammad Gondola (IOI14_gondola) C++14
0 / 100
5 ms 504 KB
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
 
#include<bits/stdc++.h>
#include "gondola.h"
using namespace std;
 
typedef long long ll ;
const ll oo = 4294967296 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 9   ;

map<int,int> mp;
vector<pair<int,int>> v;
pair<int, int> p[1000010] , rp[1000010] ;

int valid(int n, int inputSeq[]){
	return -1 ;
}

// ----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
	return -2;
}

//----------------------

int countReplacement(int n, int inputSeq[]){
	bool b = false ;
	for(int i = 0 ; i < n ; ++i){
		p[i] = {inputSeq[i] , i + 1};
		rp[i] = {inputSeq[i] , n - i};
		mp[inputSeq[i]]++;
		if(mp[inputSeq[i]] > 1)return 0;
		if(inputSeq[i] <= n){
			b = 1;
			int x = inputSeq[i];
			int f = i - 1;
			while(f > -1 && inputSeq[f] > n){
				x--;
				if(x == 0) x = n;
				v.push_back({inputSeq[f] , x});
				inputSeq[f] = x;
				mp[x]++;	
				if(mp[x] > 1) return 0 ;
				f--;
			}
			f = i + 1 ;
			x = inputSeq[i];
			while(f < n && inputSeq[f] > n){
				x++;
				if(x == n + 1) x = 1;
				v.push_back({inputSeq[f] , x});
				inputSeq[f] = x;
				mp[x]++;
				if(mp[x] > 1)return 0;
				f++;
			}
			i = f - 1;
		}
	}
	ll ans = 1 , ls = n + 1 , ans1 = 1;
	if(b){
		for(int i = 1 ; i < n ; ++i)
			if((inputSeq[i] == 1 && inputSeq[i - 1] != n) || (inputSeq[i] != 1 && inputSeq[i - 1] + 1 != inputSeq[i])) return 0;
		sort(v.begin(), v.end());
		for(auto x : v){
			if(x.first == v.back().first) continue ;
			int ok = 1;
			while(ls < x.first)
				ok++ , ls++;
			ls++;
			ans = (ans * ok) % M;
		}
	}else{
		sort(p , p + n);
		sort(rp , rp + n);
		for(int i = 0 ; i < n - 1 ; ++i){
			int ok = 1;
			while(ls < p[i].first)
				ok++ , ls++;	
			ls++;
			ans = (ans * ok) % M;
		}
		ls = n + 1;
		for(int i = 0 ; i < n - 1 ; ++i){
			int ok = 1;
			while(ls < rp[i].first)
				ok++ , ls++;	
			ls++;
			ans1 = (ans1 * ok) % M;
		}
	}
	return ans+ans1 ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 248 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -