제출 #1342952

#제출 시각아이디문제언어결과실행 시간메모리
1342952neelamneelam19마술쇼 (APIO24_show)C++20
컴파일 에러
0 ms0 KiB
#include <vector>
#include "Alice.h"

using namespce std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

std::vector<std::pair<int,int>> Alice(){
    long long x = setN(5000);
    vector<pair<int,int>> ans;
    
    for(int i=1; i<=5000; i++){
        if (i==x) continue;
        ans.push_back({i,x});
    }
    
    
    return ans;
}
#include <vector>
#include "Bob.h"

using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

long long Bob(std::vector<std::pair<int,int>> V){
    vector<int> count(5001,0);
    
    for(int i=0; i<4999; i++){
        count[V[i].first]++; count[V[i].second]++;
    }
    int max=0;
    for(int i=1; i<5001; i++){
        if(count[i]>count[max]) max =i;
    }
    
    return max;
}

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

# 1번째 컴파일 단계

Alice.cpp:4:7: error: expected nested-name-specifier before 'namespce'
    4 | using namespce std;
      |       ^~~~~~~~
Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:10:12: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   10 |     vector<pair<int,int>> ans;
      |            ^~~~
      |            std::pair
In file included from /usr/include/c++/13/bits/stl_algobase.h:64,
                 from /usr/include/c++/13/vector:62,
                 from Alice.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:187:12: note: 'std::pair' declared here
  187 |     struct pair
      |            ^~~~
Alice.cpp:10:5: error: 'vector' was not declared in this scope
   10 |     vector<pair<int,int>> ans;
      |     ^~~~~~
Alice.cpp:10:5: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
Alice.cpp:10:17: error: expected primary-expression before 'int'
   10 |     vector<pair<int,int>> ans;
      |                 ^~~
Alice.cpp:14:9: error: 'ans' was not declared in this scope
   14 |         ans.push_back({i,x});
      |         ^~~
Alice.cpp:18:12: error: 'ans' was not declared in this scope
   18 |     return ans;
      |            ^~~