QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321033#8209. Curly Palindromesucup-team2894#WA 1ms4056kbC++201.5kb2024-02-04 02:28:252024-02-04 02:28:26

Judging History

This is the latest submission verdict.

  • [2024-02-04 02:28:26]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 4056kb
  • [2024-02-04 02:28:25]
  • Submitted

answer

#include <bits/stdc++.h>
#define fr first
#define sc second
#define all(a) (a).begin(), (a).end()
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())

using namespace std;

#ifdef ONPC
mt19937 rnd(223);
#else
mt19937 rnd(chrono::high_resolution_clock::now()
			.time_since_epoch().count());
#endif

#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)

using ll = long long;
using ld = double;

const int maxn = 1e5 + 100, inf = 1e9 + 100;

pair<int, int> dif(pair<int, int> a, pair<int, int> b) {
    return {b.fr - a.fr, b.sc - a.sc};
}

ll cross(pair<int, int> a, pair<int, int> b) {
    return a.fr * (ll)b.sc - a.sc * (ll)b.fr;
}

void solve() {
    int n;
    cin >> n;
    vector<pair<int, int>> pt(n);
    vector<char> c(n);
    for (int i = 0; i < n; i++) {
        cin >> pt[i].fr >> pt[i].sc >> c[i];
    }
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            for (int k = 0; k < n; k++)
                if (i != k && i != j && j != k && c[i] == c[k] && cross(dif(pt[i], pt[j]), dif(pt[j], pt[k])) > 0) {
                    cout << "Infinity\n";
                    return;
                }
    cout << min(n, 2) << '\n';
}

int main() {
#ifdef ONPC
    freopen("../a.in", "r", stdin);
//    freopen("../a.out", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed;
    cout.precision(20);
    solve();
    cerr << "\n\nConsumed " << TIME << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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

input:

3
0 0 p
1 1 c
2 2 o

output:

2

result:

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