QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#650616 | #8209. Curly Palindromes | ucup-team3160# | WA | 1ms | 3880kb | C++14 | 1.1kb | 2024-10-18 15:51:01 | 2024-10-18 15:51:02 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 105;
int n, x[N], y[N], cc[N];
vector <int> st[N];
bool ok(int a, int b, int c)
{
return (x[b] - x[a]) * (y[c] - y[b]) - (y[b] - y[a]) * (x[c] = x[b]) > 0;
}
int xj(int a, int b, int c)
{
return (x[b] - x[a]) * (y[c] - y[b]) - (y[b] - y[a]) * (x[c] = x[b]) > 0;
}
int main()
{
scanf("%d", &n);
char ch;
int mx = 0;
int cnt[26] = {0};
for (int i = 1; i <= n; i++)
{
scanf("%d%d %c", &x[i], &y[i], &ch);
cc[i] = ch - 'a';
cnt[cc[i]]++;
mx = max(mx, cnt[cc[i]]);
st[cc[i]].push_back(i);
}
if (mx == 1)
{
printf("1\n");
return 0;
}
bool rua = false;
for (int i = 0; i < 26; i++)
{
int m = st[i].size();
for (int a = 0; a < m; a++)
for (int b = a + 1; b < m; b++)
{
for (int c = b + 1; c < m; c++)
if (xj(st[i][a], st[i][b], st[i][c]))
{
printf("Infinity\n");
return 0;
}
for (int c = 1; c <= n; c++)
if (cc[c] != i && xj(st[i][a], st[i][b], c))
{
printf("Infinity\n");
return 0;
}
}
}
printf("2\n");
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3868kb
input:
4 0 0 o 1 1 c 2 2 p 3 3 c
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
3 2 3 e 3 2 e 8 9 e
output:
Infinity
result:
ok single line: 'Infinity'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
3 0 0 p 1 1 c 2 2 o
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3852kb
input:
3 1000000000 1000000000 a 0 1000000000 b 1000000000 0 a
output:
2
result:
wrong answer 1st lines differ - expected: 'Infinity', found: '2'