제출 #1249777

#제출 시각아이디문제언어결과실행 시간메모리
1249777kduckp3개의 봉우리 (IOI25_triples)C++20
컴파일 에러
0 ms0 KiB
ll count_triples(vi a)
{
    int res = 0;
    int n = a.size();
    for(int i = 0; i < n; i++)
    {
        for(int j = i+1; j < n; j++)
        {
            for(int k = j+1; k < n; k++)
            {
                vi height = {a[i], a[j], a[k]};
                vi dist = {j - i, k - i, k - j};
                sort(all(height));
                sort(all(dist));
                if (height == dist) res++;
            }
        }
    }
    return res;
}

void sub1_part1()
{
    int n; cin >> n;
    vi a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    cout << count_triples(a) << endl;
}

컴파일 시 표준 에러 (stderr) 메시지

triples.cpp:1:1: error: 'll' does not name a type
    1 | ll count_triples(vi a)
      | ^~
triples.cpp: In function 'void sub1_part1()':
triples.cpp:24:12: error: 'cin' was not declared in this scope
   24 |     int n; cin >> n;
      |            ^~~
triples.cpp:25:5: error: 'vi' was not declared in this scope
   25 |     vi a(n);
      |     ^~
triples.cpp:26:39: error: 'a' was not declared in this scope
   26 |     for(int i = 0; i < n; i++) cin >> a[i];
      |                                       ^
triples.cpp:27:5: error: 'cout' was not declared in this scope
   27 |     cout << count_triples(a) << endl;
      |     ^~~~
triples.cpp:27:27: error: 'a' was not declared in this scope
   27 |     cout << count_triples(a) << endl;
      |                           ^
triples.cpp:27:13: error: 'count_triples' was not declared in this scope
   27 |     cout << count_triples(a) << endl;
      |             ^~~~~~~~~~~~~
triples.cpp:27:33: error: 'endl' was not declared in this scope
   27 |     cout << count_triples(a) << endl;
      |                                 ^~~~