QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#311319#3283. Parallel LinesNYCU_CartesianTree#Compile Error//C++14989b2024-01-22 10:34:592024-01-22 10:35:00

Judging History

你现在查看的是最新测评结果

  • [2024-01-22 10:35:00]
  • 评测
  • [2024-01-22 10:34:59]
  • 提交

answer

//#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> pii;
int const N = 20;
int cross(pii a, pii b){
    return a.first * b.second - a.second * b.first;
}
pii operator-(pii a, pii b){
    return {a.first - b.first, a.second - b.second};
}
pii p[N];

void Solve(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> p[i].first >> p[i].second;        
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = i + 1; j <= n; j++){
            int cnt = 0;
            for(int k = 1; k <= n; k++){
                for(int t = k + 1; t <= n; t++){
                    if(cross(p[k] - p[t], p[i] - p[j]) == 0){
                        cnt++;
                    }
                }
            }
            
            ans = max(ans, cnt);
        }
    }
    cout << ans * (ans - 1) / 2 << '\n';
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    Solve();
}

Details

answer.code:4:9: error: ‘pair’ does not name a type
    4 | typedef pair<int, int> pii;
      |         ^~~~
answer.code:6:11: error: ‘pii’ was not declared in this scope
    6 | int cross(pii a, pii b){
      |           ^~~
answer.code:6:18: error: ‘pii’ was not declared in this scope
    6 | int cross(pii a, pii b){
      |                  ^~~
answer.code:6:23: error: expression list treated as compound expression in initializer [-fpermissive]
    6 | int cross(pii a, pii b){
      |                       ^
answer.code:9:1: error: ‘pii’ does not name a type
    9 | pii operator-(pii a, pii b){
      | ^~~
answer.code:12:1: error: ‘pii’ does not name a type
   12 | pii p[N];
      | ^~~
answer.code: In function ‘void Solve()’:
answer.code:16:5: error: ‘cin’ was not declared in this scope
   16 |     cin >> n;
      |     ^~~
answer.code:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
  +++ |+#include <iostream>
    1 | //#include<bits/stdc++.h>
answer.code:18:16: error: ‘p’ was not declared in this scope
   18 |         cin >> p[i].first >> p[i].second;
      |                ^
answer.code:26:30: error: ‘p’ was not declared in this scope
   26 |                     if(cross(p[k] - p[t], p[i] - p[j]) == 0){
      |                              ^
answer.code:26:54: error: ‘cross’ cannot be used as a function
   26 |                     if(cross(p[k] - p[t], p[i] - p[j]) == 0){
      |                                                      ^
answer.code:32:19: error: ‘max’ was not declared in this scope
   32 |             ans = max(ans, cnt);
      |                   ^~~
answer.code:35:5: error: ‘cout’ was not declared in this scope
   35 |     cout << ans * (ans - 1) / 2 << '\n';
      |     ^~~~
answer.code:35:5: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code: In function ‘int main()’:
answer.code:38:5: error: ‘ios’ has not been declared
   38 |     ios::sync_with_stdio(0);
      |     ^~~
answer.code:39:5: error: ‘cin’ was not declared in this scope
   39 |     cin.tie(0);
      |     ^~~
answer.code:39:5: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?