Submission #395234

# Submission time Handle Problem Language Result Execution time Memory
395234 2021-04-28T03:43:56 Z khangal Painting Walls (APIO20_paint) C++14
0 / 100
55 ms 87260 KB
#include "paint.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef pair<ll,ll> pl;
#define pb push_back
#define ff first
#define ss second
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,mid,mn,T,sum,c[1234567],h1,h2,x,y,z,l,r,cnt,cnt1,ans;
vector<ll> vec[1234567];
bool ok[1234567],ok1;	
map<ll,ll> mp[1234567];
int minimumInstructions(
    int N, int M, int K, std::vector<int> C,
    std::vector<int> A, std::vector<std::vector<int>> B) {
	for(int i=0;i<M;i++){
		for(auto u:B[i]) vec[u].pb(i);
	}
	for(int i=N-1;i>=0;i--){
		for(auto u:vec[C[i]]){
			mp[i][u]=1;
			//i dah toog u unguur ehlehed segment iin urtiig olno
			if(mp[i+1][(u+1)%M]>0 && i < N-1){
				mp[i][u]=max(mp[i][u],mp[i+1][(u+1)%M]+1);
			}
			if(mp[i][u] >= M){
				ok[i]=1;
				//i r tseg dres ehlej bolno
			}
		}
	}
	ll segnum=0;
	for(int i=0;i<N;i++)c[i]=-1;
	for(int i=0;i<N;i++){
		//buh tsegiig ali tsegees ehleh ve gdgig olno
		if(ok[i]==1)segnum=i;
		c[i]=segnum;
	}
	for(int i=0;i<N;i++){
		cout<<c[i]<<" ";
	}
	cout<<'\n';
	int i=0;
	while(i<N ){
		//cout<<i<<" ";
		ans++;
		x=c[i];
		// x ees ehlene
		if(x==-1 || x+M <= i){
			return -1;
		}
		i = x+M;
		// i deer duusna
	}
	//cout<<'\n';
	if(x<n)return -1;
	else return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 87260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 87260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 87260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 87260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 87260 KB Output isn't correct
2 Halted 0 ms 0 KB -