QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#346021#7652. Adolescent Architecture 2hht2005WA 1ms3868kbC++141.2kb2024-03-07 19:47:192024-03-07 19:47:19

Judging History

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

  • [2024-03-07 19:47:19]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3868kb
  • [2024-03-07 19:47:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1010;
const double s2 = sqrt(2), s3 = sqrt(3), s6 = sqrt(6);
const long double P[3][3] = {{1, s2, s3}, {0.5, 1, s6 - s2}, {s3 / 6, 2 * s3 - 3, 1}};
int SG(int a, int opt) {
	if(opt == 0) {
		return max(SG(a * P[0][1], 1), SG(a * P[0][2], 2)) + 1;
	} else if(opt == 1) {
		return SG(a * P[1][2], 2) + 1;
	} else return a - 1;
}
int opt[N], a[N];
char s[N];
int calc(int r, int v, int opt) {
	// cerr<< v << ' ' << r <<' ' << opt << endl;
	int l = 1;
	while(l <= r) {
		int mid = (l + r) >> 1;
		int val = SG(mid,opt);
		if(val == v) {
			// cerr<<"OK"<<endl;
			return 1;
		}
		if(val < v)l = mid + 1;
		else r = mid - 1;
	}
	return 0;
}
signed main() {
	int n;
	scanf("%lld", &n);
	int sg = 0;
	for(int i = 1; i <= n; i++) {
		scanf("%s%lld", s + 1, a + i);
		if(s[1] == 'c')opt[i] = 0;
		else if(s[1] == 't')opt[i] = 2;
		else opt[i] = 1;
		sg ^= SG(a[i], opt[i]);
	}
	int ans = 0;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j < 3; j++) {
			int t = a[i] * P[opt[i]][j];
			if(t == a[i] * P[opt[i]][j])
				t--;
			ans += calc(t, sg ^ SG(a[i], opt[i]), j);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3792kb

input:

2
circle 2
triangle 2

output:

2

result:

ok single line: '2'

Test #2:

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

input:

2
circle 1
circle 2

output:

3

result:

ok single line: '3'

Test #3:

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

input:

5
circle 123
triangle 456
square 789
square 789
triangle 555

output:

7

result:

ok single line: '7'

Test #4:

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

input:

3
circle 299303201
square 79724391
triangle 437068198

output:

1

result:

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