QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#326611#8209. Curly Palindromesucup-team2219WA 1ms3932kbC++201.8kb2024-02-13 16:22:162024-02-13 16:22:17

Judging History

This is the latest submission verdict.

  • [2024-02-13 16:22:17]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3932kb
  • [2024-02-13 16:22:16]
  • Submitted

answer

#include <bits/stdc++.h>
#ifdef LOCAL
#include "cp_debug.h"
#else
#define debug(...) 42
#endif
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)x.size()
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template<typename T> void read(T &x){
    x = 0;char ch = getchar();ll f = 1;
    while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
    while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
template<typename T, typename... Args> void read(T &first, Args& ... args) {
    read(first);
    read(args...);
}
template<typename T> void write(T x) {
    if(x > 9) write(x/10);
    putchar(x%10 + '0');
}

void solve() {
    int n;
    read(n);
    vector<tuple<ll,ll,char>> pts(n);
    vector<int> cnt(26);
    for (auto &[x,y,c]: pts) {
        char val[3];
        read(x, y);
        scanf("%s", val);
        c = val[0];
        cnt[c-'a']++;
    }
    if(n <= 2) {
        printf("%d\n", n);
        return;
    }
    if(*max_element(all(cnt)) == 1) {
        puts("2");
    } else {
        bool all_colinear = true;
        auto [ox, oy, oc] = pts[0];
        auto [ix, iy, ic] = pts[1];
        ll bx = ix - ox, by = iy - oy;
        for(int i = 2; i < n; i++) {
            auto [px, py, pc] = pts[i];
            ll ax = px-ox, ay = py-oy;
            debug(ax, by, ay, bx);
            if(ax*by != ay*bx) {
                all_colinear = false;
            }
        }
        if(all_colinear) {
            puts("2");
        } else {
            puts("Infinity");
        }
    }
}
signed main() {
    int T; T = 1;
    while(T--) solve();
    return 0;
}

詳細信息

Test #1:

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

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: 3600kb

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: 1ms
memory: 3644kb

input:

3
0 0 p
1 1 c
2 2 o

output:

2

result:

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