QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#523314#8209. Curly PalindromesUNos_maricones#WA 0ms3620kbC++141.1kb2024-08-18 05:11:062024-08-18 05:11:06

Judging History

This is the latest submission verdict.

  • [2024-08-18 05:11:06]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3620kb
  • [2024-08-18 05:11:06]
  • Submitted

answer

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

#define ff  first
#define ss  second
#define pb  push_back

const int N = (1e5 + 5) * 50;
const int mod = 1e9 + 7;
const int oo = N + 5;

typedef pair<int,int>   pii;
typedef long long    ll;


struct pt {
  ll x,y;
  pt(){}
  pt(ll a , ll b): x(a), y(b){}

  pt operator - (const pt &q ) const {
    return {x - q.x , y - q.y };
  }
};

ll cross (pt a, pt b) {
  return a.x * b.y - a.y * b.x;
}

int main() {
  #ifdef LOCAL
  freopen("input.txt","r",stdin);
  #endif // LOCAL

  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);

  int n; cin >> n;

  if (n == 1) { 
    cout << 1 << '\n';
    return 0;
  }

  set <char> cur;
  int dup = 0;

  vector <pt> a;

  for (int i = 0; i < n; ++i) {
    int x, y; cin >> x >> y;
    a.pb({x, y});
    char c; cin >> c;
    if (cur.count (c)) dup = 1;
    cur.insert(c);
  }

  int coli = 1;
  for (int i = 2; i < n; i++) { 
    if (cross(a[i] - a[0], a[1] - a[0]) != 0) 
      coli = 0;
  }

  if (!coli && dup) cout << "Infinity\n";
  else cout << "2\n";

  return 0;
}

详细

Test #1:

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

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

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

input:

3
0 0 p
1 1 c
2 2 o

output:

2

result:

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