QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#355433#8209. Curly Palindromesucup-team228#WA 1ms3732kbC++203.6kb2024-03-16 17:41:362024-03-16 17:41:37

Judging History

This is the latest submission verdict.

  • [2024-03-16 17:41:37]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3732kb
  • [2024-03-16 17:41:36]
  • Submitted

answer

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2") // doesn't work on Yandex
//#pragma GCC target("avx") // for old judges
//#pragma GCC target("bmi,bmi2,lzcnt,popcnt") // fast bit operations

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <chrono>
#include <random>
#include <string>
#include <numeric>
#include <complex>
#include <tuple>
#include <utility>
#include <bitset>
#include <array>
#include <stack>
#include <sstream>
#include <unordered_set>

using namespace std;
typedef long long ll;

string to_string(string a) { return '"' + a + '"'; }
string to_string(char a) { return "'" + string(1, a) + "'"; }
string to_string(const char* a) { return to_string((string) a); }
string to_string(bool a) { return a ? "true" : "false"; }
template <class T1, class T2>
string to_string(pair<T1, T2> a) {
    return "(" + to_string(a.first) + ", " + to_string(a.second) + ")";
}
template <class T>
string to_string(T a) {
    bool first = true; string res = "{";
    for (const auto& i : a) {
        if (!first) res += ", ";
        first = false;
        res += to_string(i);
    }
    res += "}";
    return res;
}
void debug_out() { cerr << endl; }
template <class T1, class... T2>
void debug_out(T1 a, T2... b) {
    cerr << " " << to_string(a);
    debug_out(b...);
}

#ifdef LOCAL
#define out(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define out(...) 42
#endif

clock_t start_time; void start_timer() { start_time = clock(); }
double get_time() { return (double) (clock() - start_time) / CLOCKS_PER_SEC; }

void Solve();

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("usr/share/man/man1/input.txt", "r", stdin);
#endif
    start_timer();
    Solve();
#ifdef LOCAL
    cerr << fixed << setprecision(3);
    cerr << endl << "Time spent: " << get_time() << endl;
#endif
    return 0;
}

// do something, stay focused
// look for stupid bugs
// guess, slow, stress
// don't overgeneralize
// don't rush

// don't waste time on standings

// SOLVE THE PROBLEM OR DIE TRYING
// THE SOLUTION IS ALWAYS SIMPLE
// THE CODE IS ALWAYS SHORT

const int N = 105;
const int inf = 1e9;

struct P {
    ll x, y;
    char c;
    friend P operator-(const P& a, const P& b) {
        return {a.x - b.x, a.y - b.y};
    }
};

ll cro(const P& a, const P& b) {
    return a.x * b.y - a.y * b.x;
}

P a[N];

void Solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].x >> a[i].y >> a[i].c;
    }
    int ans = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (a[i].x == a[j].x && a[i].y == a[j].y) continue;
            ans = 2;
            break;
        }
        if (ans == 2) break;
    }
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            for (int k = j + 1; k <= n; k++) {
                set<char> all{a[i].c, a[j].c, a[k].c};
                if (all.size() == 3) continue;
                P u = a[j] - a[i];
                P v = a[k] - a[i];
                if (cro(u, v) != 0) {
                    ans = inf;
                    break;
                }
            }
            if (ans == inf) break;
        }
        if (ans == inf) break;
    }
    if (ans < inf) {
        cout << ans << "\n";
    }
    else {
        cout << "Infinity\n";
    }
}

详细

Test #1:

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

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

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

input:

3
0 0 p
1 1 c
2 2 o

output:

2

result:

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