Code Submission Evaluation System Login

HIIT Open 2016

Start:2016-05-28 11:00:00
End:2016-05-28 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2016 - Results
History
2016-05-28 12:20:05
2016-05-28 12:17:51
2016-05-28 12:16:29
2016-05-28 12:02:51
Task:Judge correctness
Sender:Game of Nolife
Submission time:2016-05-28 12:20:05
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.06 / 3.00details
#2ACCEPTED0.53 / 3.00details
#3ACCEPTED1.80 / 3.00details
#4ACCEPTED0.73 / 3.00details
#5ACCEPTED2.28 / 3.00details
#6ACCEPTED2.27 / 3.00details
#7ACCEPTED0.73 / 3.00details
#8ACCEPTED0.73 / 3.00details
#9ACCEPTED0.71 / 3.00details
#10ACCEPTED2.27 / 3.00details

Code

#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef long double ld;

int p = 10;
int n;

int A [5050][5050];
int X [5050][5050];
ll v [5050];
ll vv [5050];
ll vvv [5050];
ll u [5050];

ll parse_char(char c) {
	if (c == '+') {
		return 62;
	} else if (c == '/') {
		return 63;
	} else if (c>='0'&&c<='9') {
		return (c - '0')+52;
	} else if (c>='A'&&c<='Z'){
		return c - 'A';
	}
	return (c - 'a')+26;
}

bool random_test() {
	for (int i = 0; i < n; i++) {
		v[i] = rand()%64;
	}
	for (int i = 0; i < n; i++) {
		vv[i] = 0;
		for (int j = 0; j < n; j++) {
			vv[i] += A[j][i]*v[j];
		}
		vv[i] &= 63;
	}
	for (int i = 0; i < n; i++) {
		vvv[i] = 0;
		for (int j = 0; j < n; j++) {
			vvv[i] += A[i][j]*vv[j];
		}
		vvv[i] &= 63;
	}
	for (int i = 0; i < n; i++) {
		u[i] = 0;
		for (int j = 0; j < n; j++) {
			u[i] += X[j][i]*v[j];
		}
		u[i] &= 63;
	}
	for (int i = 0; i < n; i++) {
		//cout << "u1: " << u[i] << "\n";
		if ((u[i] - vvv[i])%64 != 0) {
			return false;
		}
	}
	return true;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	for (int tc = 0; tc < t; tc++) {
		cin >> n;
		for (int i = 0; i < n + 10; i++) {
			for (int j = 0; j < n + 10; j++) {
				A[i][j] = 0;
				X[i][j] = 0;
			}
		}
		for (int i = 0; i < n; i++) {
			string row;
			cin >> row;
			for (int j = 0; j < n; j++) {
				A[i][j] = parse_char(row[j]);
				//cout << A[i][j] << " ";
			}
			//cout << "\n";
		}
		for (int i = 0; i < n; i++) {
			string row;
			cin >> row;
			for (int j = 0; j < n; j++) {
				X[i][j] = parse_char(row[j]);
				//cout << X[i][j] << " ";
			}
			//cout << "\n";
		}
		bool ok = true;
		for (int i = 0; i < p; i++) {
			ok = ok&&random_test();
			if (!ok) {
				break;
			}
		}
		if (ok) {
			cout << "1\n";
		} else {
			cout << "0\n";
		}
	}
}

Test details

Test 1

Verdict: ACCEPTED

input
500
12
N49lyQuAZh1l
PwNJA+wuTBr+
HO09lJg8kbup
yDfjEETO9FbY
Aplqi5vnLc98
0/hYfkOFcZVV
/ckgzeISmwGl
br2MOJZnYtrh
fEUiVy4Miasn
0u09RS8s83nZ
gQjEE8dDfIk7
g8si6nOeea01
XCc/9qK8WGTj
CK39fpfbB/4q
c3GYFr/oDwzG
/9Yf5gOIARp8
9fF53gW9SfQF
qprggzi/g4br
...
view   save

correct output
0
0
1
1
1
0
0
0
0
0
1
1
0
0
0
1
0
0
1
1
...
view   save

user output
0
0
1
1
1
0
0
0
0
0
1
1
0
0
0
1
0
0
1
1
...
view   save

Test 2

Verdict: ACCEPTED

input
3
666
OvHf9jpB0RViia/ZD3gRQ7o1FELYh3...
L5gSvHpMnBJLnEP2owz8yZ7PgwI62l...
view   save

correct output
0
0
1
view   save

user output
0
0
1
view   save

Test 3

Verdict: ACCEPTED

input
2
517
RWVknnH+hL6AfeKFbOu6OuAJL9dvLw...
FM2IGsbyia33qivbugYG85wbElidVu...
view   save

correct output
0
1
view   save

user output
0
1
view   save

Test 4

Verdict: ACCEPTED

input
1
5000
QP9pS1MOq6eDDKGQh//TrJUIvbM53a...
view   save

correct output
0
view   save

user output
0
view   save

Test 5

Verdict: ACCEPTED

input
1
5000
RSX7ZuQE6A94s8s+9oP1uCDHRkmZ+7...
view   save

correct output
1
view   save

user output
1
view   save

Test 6

Verdict: ACCEPTED

input
1
5000
b0V0j4vQ8CeiJrcUk2yssPF1B9EEDb...
view   save

correct output
1
view   save

user output
1
view   save

Test 7

Verdict: ACCEPTED

input
1
5000
VLdpW71f4Cdr+xdCRlwmAnNfMjqwMU...
view   save

correct output
0
view   save

user output
0
view   save

Test 8

Verdict: ACCEPTED

input
1
5000
kBZaGETPWmyNR4NCvCPbJnvq2+JBfP...
view   save

correct output
0
view   save

user output
0
view   save

Test 9

Verdict: ACCEPTED

input
1
5000
PES9AhJn+FZBVO5gqRLYbavSvaDUfU...
view   save

correct output
0
view   save

user output
0
view   save

Test 10

Verdict: ACCEPTED

input
1
5000
EoXwgdrAtKtV4M7jn0jAkNwkJX+be9...
view   save

correct output
1
view   save

user output
1
view   save