Submission #817112


Source Code Expand

Copy
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <vector>
#include <list>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <climits>
#include <map>
#include <math.h>

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;

	vector<int> d1 = {0,1,2,3,4,5,6,7,8,9};
	vector<int> dd;

	for (int i = 0; i < k; i++)
	{
		int t;
		cin >> t;
		d1[t] = -1;
	}
	for (int i = 0; i <10; i++)
	{
		if (d1[i] != -1){ dd.push_back(d1[i]); }
	}

	int digit[5] = { 0 };
	int a = 0,b=0,c=0,d=0,e=0;
	int size = dd.size();
	bool f = false;
	while (1){

		int ans = digit[4] * 10000;
		ans += digit[3] * 1000;
		ans += digit[2] * 100;
		ans += digit[1] * 10;
		ans += digit[0];

		if (ans >= n){ cout << ans << endl; return 0; }
		a++;digit[0] = dd[a%size];
		if (a%size == 0){ f = true; }
		if (f == true){ b++; digit[1] = dd[b%size];if (b%size != 0){ f = false; } else{ f = true; } }
		if (f == true){ c++; digit[2] = dd[c%size];if (c%size != 0){ f = false; } else { f = true; } }
		if (f == true){ d++; digit[3] = dd[d%size];if (d%size != 0){ f = false; } else { f = true; } }
		if (f == true ){ e++; digit[4] = dd[e%size];if (e%size != 0){ f = false; } else { f = true; } }
		
	}


	return 0;
}

Submission Info

Submission Time
Task C - Iroha's Obsession
User NNN
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1292 Byte
Status WA
Exec Time 4 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status AC
AC × 7
WA × 3
Set Name Test Cases
Sample
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_X_01.txt, subtask1_X_02.txt, subtask1_X_03.txt, subtask1_X_04.txt, subtask1_X_05.txt, subtask1_X_06.txt, subtask1_X_07.txt, subtask1_X_08.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 4 ms 256 KB
subtask0_sample_02.txt AC 4 ms 256 KB
subtask1_X_01.txt AC 4 ms 256 KB
subtask1_X_02.txt AC 4 ms 256 KB
subtask1_X_03.txt AC 4 ms 256 KB
subtask1_X_04.txt WA 4 ms 256 KB
subtask1_X_05.txt WA 4 ms 256 KB
subtask1_X_06.txt AC 4 ms 256 KB
subtask1_X_07.txt AC 4 ms 256 KB
subtask1_X_08.txt WA 4 ms 256 KB