QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#399167#8209. Curly PalindromesIntellegentCompile Error//C++142.0kb2024-04-25 23:51:212024-04-25 23:51:22

Judging History

This is the latest submission verdict.

  • [2024-04-25 23:51:22]
  • Judged
  • [2024-04-25 23:51:21]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << " = " << x << "\n";
#define vdebug(a) cout << #a << " = "; for(auto x: a) cout << x << " "; cout << "\n";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int uid(int a, int b) { return uniform_int_distribution<int>(a, b)(rng); }
ll uld(ll a, ll b) { return uniform_int_distribution<ll>(a, b)(rng); }

void solve(){
    int n;
    cin >> n;
    
    vector<array<int, 2>> a(n);
    vector<char> b(n);
    for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1] >> b[i];
    
    int ans = 1;
    vector<int> cnts(26);
    for (char c : b) {
        if (cnts[c - 'a'] > 0) ans = 2;
        cnts[c - 'a']++; 
    }
    
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++){
            for (int k = j + 1; k < n; k++){
                array<int, 2> d1, d2;
                d1[0] = a[i][0] - a[j][0];
                d1[1] = a[i][1] - a[j][1];
                d2[0] = a[i][0] - a[k][0];
                d2[1] = a[i][1] - a[k][1];
                
                if (d1[0] < 0){
                    d1[0] = -d1[0];
                    d1[1] = -d1[1];
                }
                
                if (d2[0] < 0){
                    d2[0] = -d2[0];
                    d2[1] = -d2[1];
                }
                
                int g = gcd(d1[0], d1[1]);
                d1[0] /= g;
                d1[1] /= g;
                
                g = gcd(d2[0], d2[1]);
                d2[0] /= g;
                d2[1] /= g;
                
                if (d1[0] == d2[0] && d1[1] == d2[1]) continue;
                
                if (b[i] == b[j] || b[i] == b[k] || b[j] == b[k]) {
                    cout << "Infinity";
                    return;
                }
            }
        }
    }
    
    cout << ans;
}

int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
    
    solve();
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:44:25: error: ‘gcd’ was not declared in this scope
   44 |                 int g = gcd(d1[0], d1[1]);
      |                         ^~~