QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#372805#8209. Curly PalindromesLainWA 1ms3832kbC++231.4kb2024-03-31 19:26:142024-03-31 19:26:16

Judging History

This is the latest submission verdict.

  • [2024-03-31 19:26:16]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3832kb
  • [2024-03-31 19:26:14]
  • Submitted

answer

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

#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()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  using P = pair<ll, ll>;
  int n;
  cin >> n;
  vector<P> pts(n);
  vector<char> label(n);
  rep(i, 0, n) {
	  cin >> pts[i].first >> pts[i].second >> label[i];
  }
  auto cross = [&](P& a, P& b)->ll {
	  return a.first*b.second - b.first * a.second;
  };
  rep(i, 0, n) {
	  rep(j, 0, n) {
		  if (i == j) continue;
		  auto P = make_pair(pts[j].first - pts[i].first, pts[j].second - pts[i].second);
		  rep(k, 0, n) {
			  if (i == k || j == k) continue;
			  auto Q = make_pair(pts[k].first - pts[j].first, pts[k].second - pts[j].second);
			  if (label[i] == label[k]) {
				  if (cross(P, Q) > 0) {
					  cout << "Infinity\n";
					  return 0;
				  }
			  }

			  if (label[j] == label[k]) {
				  rep(l, 0, n) {
					  if (i == l || j== l || k == l) continue;
					  if (label[i] != label[l]) continue;
					  auto R = make_pair(pts[l].first - pts[k].first, pts[l].second - pts[k].second);
					  if (cross(P, Q) > 0 && cross(Q, R) > 0) {
						  cout << "Infinity\n";
						  return 0;
					  }
				  }
			  }
		  }
	  }
  }
  cout << min(n, 2) << '\n';
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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

input:

3
0 0 p
1 1 c
2 2 o

output:

2

result:

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