Submission #1356814

#TimeUsernameProblemLanguageResultExecution timeMemory
1356814orgiloogiiMagic Show (APIO24_show)C++20
Compilation error
0 ms0 KiB
#include <vector>
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;

vector<pair<int,int>> Alice(){
    long long x = setN(5000);
    vector <pair <int, int>> adj;
    for (int i = 1;i <= 5000;i++) {
    	if (i == x) continue;
    	adj.push_back({min{i, x}, max(i, x)});
    }
    return adj;
}
#include <vector>
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;

long long Bob(vector<pair<int,int>> v){
	map <int, int> cnt;
	for (auto [x, y] : v) {
		cnt[x]++;
		cnt[y]++;
		if (cnt[x] > 1) return x;
		else if (cnt[y] > 1) return y;
	}
}

Compilation message (stderr)

# 1번째 컴파일 단계

Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:11:27: error: expected '}' before '{' token
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                       ~   ^
Alice.cpp:11:27: error: expected ')' before '{' token
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                      ~    ^
      |                           )
Alice.cpp:11:38: error: no matching function for call to 'max(int&, long long int&)'
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                                   ~~~^~~~~~
In file included from /usr/include/c++/13/vector:62,
                 from Alice.cpp:1:
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
Alice.cpp:11:38: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                                   ~~~^~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
Alice.cpp:11:38: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                                   ~~~^~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from Alice.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
Alice.cpp:11:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                                   ~~~^~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
Alice.cpp:11:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                                   ~~~^~~~~~
Alice.cpp:11:45: error: expected primary-expression before ')' token
   11 |         adj.push_back({min{i, x}, max(i, x)});
      |                                             ^
Alice.cpp:12:5: warning: no return statement in function returning non-void [-Wreturn-type]
   12 |     }
      |     ^
Alice.cpp: At global scope:
Alice.cpp:13:5: error: expected unqualified-id before 'return'
   13 |     return adj;
      |     ^~~~~~
Alice.cpp:14:1: error: expected declaration before '}' token
   14 | }
      | ^