QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#273738#7877. Balanced Arrayucup-team1055#WA 0ms3800kbC++201.7kb2023-12-03 03:45:142023-12-03 03:45:15

Judging History

你现在查看的是最新测评结果

  • [2023-12-03 03:45:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3800kb
  • [2023-12-03 03:45:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)

template <typename T> bool chmin(T &a, const T &b) {
	if (a <= b) return false;
	a = b;
	return true;
}

template <typename T> bool chmax(T &a, const T &b) {
	if (a >= b) return false;
	a = b;
	return true;
}

template <typename T> T max(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
	return ret;
}

template <typename T> T min(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
	return ret;
}

template <typename T> T sum(vector<T> &a){
	T ret = 0;
	for (int i=0; i<(int)a.size(); i++) ret += a[i];
	return ret;
}

int v[300];

int henkan(string s){
	int f = 0;
	rep(i,0,(int)s.size()){
		f = f * 62 + v[s[i]];
	}
	return f;
}

int main(){
	
	{
		int piv = 0;
		rep(i,'0','9'+1){
			v[i] = piv;
			piv++;
		}
		rep(i,'a','z'+1){
			v[i] = piv;
			piv++;
		}
		rep(i,'A','Z'+1){
			v[i] = piv;
			piv++;
		}
	}

	int n; cin >> n;
	vector<int> a(n);
	rep(i,0,n){
		string s; cin >> s;
		a[i] = henkan(s);
	}

	int now = 1;
	int piv = 0;
	vector<bool> ans(n);
	rep(i,0,n){
		while(true){
			if (i-now*2 < 0){
				break;
			}
			bool mode = true;
			rrep(j, piv, i-now*2+1){
				if (a[j] - a[j + now] * 2 + a[j + now*2] != 0){
					mode = false;
					break;
				}
			}
			if (mode){
				piv = i-now*2;
				ans[i] = 1;
				break;
			}
			now++;
		}
	}

	rep(i,0,n){
		cout << ans[i];
	}
	cout << '\n';

	
}


详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3576kb

input:

3
1 2 3

output:

001

result:

ok single line: '001'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

9
1 2 3 2 5 4 3 8 5

output:

001010111

result:

ok single line: '001010111'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

9
1C 3f 4S 3h 88 6x 4W d1 8c

output:

001010111

result:

ok single line: '001010111'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3800kb

input:

49
71FjQ 71FzG 71FjR 71FjG 71FjS 71F3G 71FjT 71ENG 71FjU 71ExG 71FzG 71Fko 71FjW 71FOM 71FPm 71FzG 71FPO 71FP9 71FzG 71Fkc 71FzG 7AXBr 71FPH 8nKLh 71Fk2 71FzG 71FkK 4AGIE 71Fk9 6EfCL 71FPN 71FjJ 71FPb 7H3TC 71Gks 71FzG 71FPI 71FzG 6Oayg 71FPc 71FPw 71FPN 71Fkm 71FPK 71FPK 6Az4J 71FPI 71FzG 71Fke

output:

0000111111111110000000001000000000111000100000001

result:

wrong answer 1st lines differ - expected: '0000111111001000000000001000000000110000100000001', found: '0000111111111110000000001000000000111000100000001'