제출 #1364966

#제출 시각아이디문제언어결과실행 시간메모리
1364966biserailievaToy Design (EGOI22_toydesign)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

void ToyDesign(int n, int max_ops)
{
    vector<pair<int,int>> result;
    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            int x=Connected(0, i, j);
            if(x==0)
            {
                result.push_back({i, j});
            }
        }
    }
    DescribeDesign(result);
}
int Connected(int a , int i , int j){
    cout << "? " << a << ' ' << i << ' ' << j << endl ;
    int k ; cin >> k ; return k ;
}
void DescribeDesign(vector<pair<int,int>> result){
    cout << "! " << (int)result.size() << endl ;
    for(auto it:result) cout << it.F << ' ' << it.S << endl ;
}
int main(){
    cin >> n ;
    ToyDesign(n,n) ;
    return 0 ;
}

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

Main.cpp: In function 'void ToyDesign(int, int)':
Main.cpp:11:19: error: 'Connected' was not declared in this scope
   11 |             int x=Connected(0, i, j);
      |                   ^~~~~~~~~
Main.cpp:18:5: error: 'DescribeDesign' was not declared in this scope
   18 |     DescribeDesign(result);
      |     ^~~~~~~~~~~~~~
Main.cpp: In function 'void DescribeDesign(std::vector<std::pair<int, int> >)':
Main.cpp:26:36: error: 'struct std::pair<int, int>' has no member named 'F'
   26 |     for(auto it:result) cout << it.F << ' ' << it.S << endl ;
      |                                    ^
Main.cpp:26:51: error: 'struct std::pair<int, int>' has no member named 'S'
   26 |     for(auto it:result) cout << it.F << ' ' << it.S << endl ;
      |                                                   ^
Main.cpp: In function 'int main()':
Main.cpp:29:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   29 |     cin >> n ;
      |            ^
      |            yn