Submission #10432135


Source Code Expand

Copy
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
void init() {
	iostream::sync_with_stdio(false);

}

#define int ll

void solve() {
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>> cnter;
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		a--;
		cnter.push_back(mp(a, b));
	}
	for (int i = 0; i < 1e5; ++i) {
		string s = to_string(i);
		if (s.length() != n) continue;
		int ok = 1;
		REP(q, cnter.size()) {
			if (s[cnter[q].first] != cnter[q].second + '0') {
				ok = 0;
			}
		}
		if (ok == 1) {
			cout << i << endl;
			return;
		}
	}
	cout << -1 << endl;
}

#undef int

int main() {
	init();
	solve();
}

Submission Info

Submission Time
Task C - Guess The Number
User kotamanegi
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1216 Byte
Status AC
Exec Time 15 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 18
Set Name Test Cases
Sample 00-sample-00, 00-sample-01, 00-sample-02
All 00-sample-00, 00-sample-01, 00-sample-02, 01-handmade-00, 01-handmade-01, 01-handmade-02, 01-handmade-03, 01-handmade-04, 02-random-00, 02-random-01, 02-random-02, 02-random-03, 02-random-04, 02-random-05, 02-random-06, 02-random-07, 02-random-08, 02-random-09
Case Name Status Exec Time Memory
00-sample-00 AC 1 ms 256 KB
00-sample-01 AC 15 ms 256 KB
00-sample-02 AC 15 ms 256 KB
01-handmade-00 AC 1 ms 256 KB
01-handmade-01 AC 1 ms 256 KB
01-handmade-02 AC 1 ms 256 KB
01-handmade-03 AC 1 ms 256 KB
01-handmade-04 AC 1 ms 256 KB
02-random-00 AC 1 ms 256 KB
02-random-01 AC 1 ms 256 KB
02-random-02 AC 1 ms 256 KB
02-random-03 AC 1 ms 256 KB
02-random-04 AC 1 ms 256 KB
02-random-05 AC 1 ms 256 KB
02-random-06 AC 1 ms 256 KB
02-random-07 AC 15 ms 256 KB
02-random-08 AC 1 ms 256 KB
02-random-09 AC 1 ms 256 KB