CODE FESTIVAL 2016 qual A

Submission #1421020

Source codeソースコード

#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<random>
#include<unordered_set>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const int big=1e9+10;
const long double pai=3.141592653589793238462643383279;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(b==0){return a;}return gcd(b,a%b);}//a>b
llint lcm(llint a,llint b){return (a/gcd(max(a,b),min(a,b)))*b;}
int main(void){
	int n,m,q,i,j,zyu=1,doc=7;cin>>n>>m>>q;doc=n;
	vector<int>ban(q);//入力 番号
	vector<deque<int>>numlis(m+1);//どこに番号があるのだろう?
	vector<int>las(n);//最後に番号入れたのいつ?
	vector<bool>mita(m+1);
	for(i=0;i<n;i++){las[i]=big;}
	for(i=0;i<q;i++){
		int in;cin>>in;
		ban[i]=in;
		numlis[in].puf(i);
	}
	for(i=q-1;i>=0;i--){
		int no=ban[i];
		if(mita[no]){continue;}//skipped
		for(j=0;j<min(n,(int)numlis[no].size());j++){
			if(las[j]<numlis[no][j]){cout<<"No"<<endl;return 0;}
			las[j]=numlis[no][j];
		}
		if(numlis[no].size()<n){
			while(mita[zyu]){zyu++;}
			if(zyu!=no){cout<<"No"<<endl;return 0;}
		}
		mita[no]=true;
		for(j=numlis[no].size();j<doc;j++){las[j]=-999;}
		doc=numlis[no].size();
	}
	cout<<"Yes"<<endl;
	return 0;
}

Submission

Task問題 E - LRU パズル / LRU Puzzle
User nameユーザ名 WA_TLE
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 RE
Score得点 0
Source lengthソースコード長 1723 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt,0_03.txt
All 0 / 1200 0_00.txt,0_01.txt,0_02.txt,0_03.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt,1_11.txt,1_12.txt,1_13.txt,1_14.txt,1_15.txt,1_16.txt,1_17.txt,1_18.txt,1_19.txt,1_20.txt,1_21.txt,1_22.txt,1_23.txt,1_24.txt,1_25.txt,1_26.txt,1_27.txt,1_28.txt,1_29.txt,1_30.txt,1_31.txt,1_32.txt,1_33.txt,1_34.txt,1_35.txt,1_36.txt,1_37.txt,1_38.txt,1_39.txt,1_40.txt,1_41.txt,1_42.txt,1_43.txt,1_44.txt,1_45.txt,1_46.txt,1_47.txt,1_48.txt,1_49.txt,1_50.txt,1_51.txt,1_52.txt,1_53.txt,1_54.txt,1_55.txt,1_56.txt,1_57.txt,1_58.txt,1_59.txt,1_60.txt,1_61.txt,1_62.txt,1_63.txt,1_64.txt,1_65.txt,1_66.txt,1_67.txt,1_68.txt,1_69.txt,1_70.txt,1_71.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 1 ms 256 KB
0_01.txt AC 1 ms 256 KB
0_02.txt AC 1 ms 256 KB
0_03.txt AC 1 ms 256 KB
1_00.txt AC 1 ms 256 KB
1_01.txt AC 1 ms 256 KB
1_02.txt AC 59 ms 68608 KB
1_03.txt AC 60 ms 68608 KB
1_04.txt AC 59 ms 68608 KB
1_05.txt AC 59 ms 68608 KB
1_06.txt AC 117 ms 119808 KB
1_07.txt AC 117 ms 119808 KB
1_08.txt AC 115 ms 119808 KB
1_09.txt AC 116 ms 119808 KB
1_10.txt AC 74 ms 60032 KB
1_11.txt AC 73 ms 60032 KB
1_12.txt AC 76 ms 60032 KB
1_13.txt AC 72 ms 60032 KB
1_14.txt AC 73 ms 60032 KB
1_15.txt AC 73 ms 60032 KB
1_16.txt AC 73 ms 60032 KB
1_17.txt AC 72 ms 60032 KB
1_18.txt WA
1_19.txt AC 80 ms 65408 KB
1_20.txt WA
1_21.txt AC 123 ms 115456 KB
1_22.txt WA
1_23.txt AC 91 ms 78080 KB
1_24.txt WA
1_25.txt AC 91 ms 76160 KB
1_26.txt RE
1_27.txt AC 19 ms 1152 KB
1_28.txt WA
1_29.txt AC 27 ms 3840 KB
1_30.txt WA
1_31.txt AC 55 ms 50944 KB
1_32.txt WA
1_33.txt AC 61 ms 52480 KB
1_34.txt WA
1_35.txt AC 68 ms 54016 KB
1_36.txt WA
1_37.txt AC 66 ms 49408 KB
1_38.txt WA
1_39.txt AC 97 ms 93184 KB
1_40.txt WA
1_41.txt AC 117 ms 109312 KB
1_42.txt WA
1_43.txt AC 22 ms 1408 KB
1_44.txt WA
1_45.txt AC 23 ms 1280 KB
1_46.txt WA
1_47.txt AC 40 ms 24320 KB
1_48.txt WA
1_49.txt AC 65 ms 58368 KB
1_50.txt WA
1_51.txt AC 22 ms 2048 KB
1_52.txt WA
1_53.txt AC 27 ms 4352 KB
1_54.txt WA
1_55.txt AC 37 ms 25728 KB
1_56.txt WA
1_57.txt AC 68 ms 60544 KB
1_58.txt WA
1_59.txt AC 20 ms 1152 KB
1_60.txt WA
1_61.txt AC 19 ms 1152 KB
1_62.txt WA
1_63.txt AC 56 ms 66560 KB
1_64.txt WA
1_65.txt AC 60 ms 53376 KB
1_66.txt WA
1_67.txt AC 17 ms 1408 KB
1_68.txt WA
1_69.txt AC 19 ms 1408 KB
1_70.txt WA
1_71.txt AC 61 ms 51584 KB