QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#320406 | #8209. Curly Palindromes | ucup-team197# | WA | 1ms | 3700kb | C++20 | 1.0kb | 2024-02-03 16:25:50 | 2024-02-03 16:25:51 |
Judging History
answer
#include <iostream>
using namespace std;
typedef long long ll;
const int N = 100 + 3;
ll n;
pair<ll, ll> p[N];
char c[N];
ll cross(pair<ll, ll> a, pair<ll, ll> b){
return a.first * b.second - b.first * a.second;
}
pair<ll, ll> subtract(pair<ll, ll> a, pair<ll, ll> b){
return pair{a.first - b.first, a.second - b.second};
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 0; i < n; ++i)
cin >> p[i].first >> p[i].second >> c[i];
if(n <= 2){
cout << n << "\n";
return 0;
}
bool on_line = true;
for(int i = 2; i < n; ++i){
on_line &= !cross(subtract(p[i - 1], p[i - 2]), subtract(p[i], p[i - 2]));
}
bool same_c = false;
for(int i = 0; i < n; ++i){
for(int j = i + 1; j < n; ++j){
if(c[i] == c[j]){
same_c = true;
}
}
}
if(on_line || !same_c){
cout << "2\n";
return 0;
}
cout << "Infinity\n";
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3700kb
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: 3656kb
input:
3 2 3 e 3 2 e 8 9 e
output:
Infinity
result:
ok single line: 'Infinity'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3700kb
input:
3 0 0 p 1 1 c 2 2 o
output:
2
result:
wrong answer 1st lines differ - expected: '1', found: '2'