submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s193513081 | p03645 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
long long x;
public:
mint(long long x = 0) : x((x% mod + mod) % mod) {}
mint operator-() const {
return mint(-x);
}
mint& operator+=(const mint & a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint & operator-=(const mint & a) {
if ((x += mod - a.x) >= mod) x -= mod;
return *this;
}
mint & operator*=(const mint & a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint & a) const {
mint res(*this);
return res += a;
}
mint operator-(const mint & a) const {
mint res(*this);
return res -= a;
}
mint operator*(const mint & a) const {
mint res(*this);
return res *= a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t >> 1);
a *= a;
if (t & 1) a *= *this;
return a;
}
// for prime mod
mint inv() const {
return pow(mod - 2);
}
mint& operator/=(const mint & a) {
return (*this) *= a.inv();
}
mint operator/(const mint & a) const {
mint res(*this);
return res /= a;
}
friend ostream& operator<<(ostream & os, const mint & m) {
os << m.x;
return os;
}
};
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
if (rest == 0) {
f(indexes);
}
else {
if (s < 0) return;
recursive_comb(indexes, s - 1, rest, f);
indexes[rest - 1] = s;
recursive_comb(indexes, s - 1, rest - 1, f);
}
}
// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
vector<int>indexes(k);
recursive_comb(indexes, n - 1, k, f);
}
int main() {
map<ll, ll>A;
ll N, M;
cin >> N>>M;
vector<ll, ll>a(M), b(M);
rep(i, M) {
cin >> a[i] >> b[i];
A[a[i] + b[i] * N]=1;
}
rep(i, M) {
if (a[i] == 1) {
if (A[b[i] + N * N] == 1) {
cout << "POSSIBLE";
return 0;
}
}
}
cout << "IMPOSSIBLE";
}
| In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<long long int, long long int>':
/usr/include/c++/14/bits/stl_vector.h:428:11: required from 'class std::vector<long long int, long long int>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
a.cc:93:19: required from here
93 | vector<ll, ll>a(M), b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'long long int' is not a class, struct, or union type
87 | rebind<_Tp>::other _Tp_alloc_type;
| ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'long long int' is not a class, struct, or union type
89 | pointer;
| ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<long long int, long long int>':
a.cc:93:19: required from here
93 | vector<ll, ll>a(M), b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<long long int, long long int>::_Base'
518 | using _Base::_M_allocate;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<long long int, long long int>::_Base'
519 | using _Base::_M_deallocate;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<long long int, long long int>::_Base'
521 | using _Base::_M_get_Tp_allocator;
| ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:95:25: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
95 | cin >> a[i] >> b[i];
| ^
a.cc:95:33: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
95 | cin >> a[i] >> b[i];
| ^
a.cc:96:20: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
96 | A[a[i] + b[i] * N]=1;
| ^
a.cc:96:27: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
96 | A[a[i] + b[i] * N]=1;
| ^
a.cc:100:22: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
100 | if (a[i] == 1) {
| ^
a.cc:101:32: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
101 | if (A[b[i] + N * N] == 1) {
| ^
|
s338356912 | p03645 | C++ | #include <iostream>
#include <cstdio>
#include <queue>
using namespace std;
bool matrix[200000+1][200000+1] = {false};
long long n, m;
int main(){
cin >> n >> m;
for(int i = 1;i <= m; i++){
long long a, b;
cin >> a >> b;
matrix[a][b] = true;
matrix[b][a] = true;
}
int distance[n+1];
distance[1] = 0;
bool flag = false;
for(int i = 1; i <= n; i++){
if(matrix[1][i] == true){
if(matrix[i][n] == true){
flag = true;
break;
}
}
}
if(flag == true){
printf("POSSIBLE\n");
}
else{
printf("IMPOSSIBLE\n");
}
return 0;
} | /tmp/ccgOaZ4q.o: in function `main':
a.cc:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccgOaZ4q.o
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccgOaZ4q.o
a.cc:(.text+0xb9): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccgOaZ4q.o
a.cc:(.text+0xc5): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccgOaZ4q.o
a.cc:(.text+0x143): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccgOaZ4q.o
a.cc:(.text+0x17f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccgOaZ4q.o
collect2: error: ld returned 1 exit status
|
s189259720 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
bool graph[][] = bool[200000][200000];
for(int i=0; i<m; i++){
int a,b;
cin >> a >> b;
graph[a-1][b-1] = true;
graph[b-1][a-1] = true;
}
for(int i=0; i<n; i++){
if(graph[0][i] && graph[i][n-1]){
cout << "POSSIBLE" << endl;
return;
}
}
cout << "IMPOSSIBLE" << endl;
}
| a.cc: In function 'int main()':
a.cc:7:8: error: declaration of 'graph' as multidimensional array must have bounds for all dimensions except the first
7 | bool graph[][] = bool[200000][200000];
| ^~~~~
a.cc:7:20: error: expected primary-expression before 'bool'
7 | bool graph[][] = bool[200000][200000];
| ^~~~
a.cc:11:5: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
11 | graph[a-1][b-1] = true;
| ^~~~~
| isgraph
a.cc:15:8: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
15 | if(graph[0][i] && graph[i][n-1]){
| ^~~~~
| isgraph
a.cc:17:7: error: return-statement with no value, in function returning 'int' [-fpermissive]
17 | return;
| ^~~~~~
|
s794017793 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin >> n >> m;
vector<int> a(n),b(n),f(n),e(n);
for (int i = 0; i < n; i++)
{
cin >> a[i] >> b[i];
if(a[i] == 1)f.push_back(b[i]);
if(b[i] == n)e.push_back(a[i]);
}
int i;
for (i = 0; i < f.size(); i++)
{
if(binary_search(e.begin(),e.end(),f[i]))break;
}
if(i == f.size())cout << "IM";
cout << "POSSIBLE"
} | a.cc: In function 'int main()':
a.cc:24:23: error: expected ';' before '}' token
24 | cout << "POSSIBLE"
| ^
| ;
25 | }
| ~
|
s560696575 | p03645 | C++ | #define MOD_TYPE 1
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};
#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";
inline void init_main()
{
cin.tie(0);
ios::sync_with_stdio(false);
cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return true;
}
return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return true;
}
return false;
}
inline ll CEIL(ll a, ll b)
{
return (a + b - 1) / b;
}
#pragma endregion
template <int MOD>
struct Fp
{
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD)
{
if (val < 0)
v += MOD;
}
constexpr int getmod()
{
return MOD;
}
constexpr Fp operator-() const noexcept
{
return val ? MOD - val : 0;
}
constexpr Fp operator+(const Fp &r) const noexcept
{
return Fp(*this) += r;
}
constexpr Fp operator-(const Fp &r) const noexcept
{
return Fp(*this) -= r;
}
constexpr Fp operator*(const Fp &r) const noexcept
{
return Fp(*this) *= r;
}
constexpr Fp operator/(const Fp &r) const noexcept
{
return Fp(*this) /= r;
}
constexpr Fp &operator+=(const Fp &r) noexcept
{
val += r.val;
if (val >= MOD)
val -= MOD;
return *this;
}
constexpr Fp &operator-=(const Fp &r) noexcept
{
val -= r.val;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator*=(const Fp &r) noexcept
{
val = val * r.val % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr Fp &operator/=(const Fp &r) noexcept
{
long long a = r.val, b = MOD, u = 1, v = 0;
while (b)
{
long long t = a / b;
a -= t * b;
swap(a, b);
u -= t * v;
swap(u, v);
}
val = val * u % MOD;
if (val < 0)
val += MOD;
return *this;
}
constexpr bool operator==(const Fp &r) const noexcept
{
return this->val == r.val;
}
constexpr bool operator!=(const Fp &r) const noexcept
{
return this->val != r.val;
}
friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept
{
return os << x.val;
}
friend constexpr istream &operator>>(istream &is, Fp<MOD> &x) noexcept
{
return is >> x.val;
}
};
Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept
{
if (n == 0)
return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1)
t = t * a;
return t;
}
using mint = Fp<MOD>;
int main()
{
init_main();
set<int> E[200010];
int n, m;
cin >> n >> m;
rep(i, m)
{
int a, b;
cin >> a >> b;
a--, b--;
E[a].push_back(b);
E[b].push_back(a);
}
rep(i, n)
{
if (E[i].count(a) && E[i].count(b))
{
cout << "POSSIBLE\n";
return 0;
}
}
cout << "IMPOSSIBLE\n";
return 0;
}
| a.cc: In function 'int main()':
a.cc:208:10: error: 'class std::set<int>' has no member named 'push_back'
208 | E[a].push_back(b);
| ^~~~~~~~~
a.cc:209:10: error: 'class std::set<int>' has no member named 'push_back'
209 | E[b].push_back(a);
| ^~~~~~~~~
a.cc:213:20: error: 'a' was not declared in this scope
213 | if (E[i].count(a) && E[i].count(b))
| ^
a.cc:213:37: error: 'b' was not declared in this scope
213 | if (E[i].count(a) && E[i].count(b))
| ^
|
s313144878 | p03645 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
int main(){
int n, m; scanf("%d %d", &n, &m);
vector<priority_queue<int>> v(n);
rep(i, m){
int a, b; scanf("%d %d", &a, &b); --a; --b;
v[a].push(b);
v[b].push(a);
}
bool b = 0;
while(!v[0].empty()){
int c = v[0].top();
if(v[c].top == n-1){
b = 1;
break;
}
v[0].pop();
}
if(b) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:16:13: error: invalid use of member function 'std::priority_queue<_Tp, _Sequence, _Compare>::const_reference std::priority_queue<_Tp, _Sequence, _Compare>::top() const [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>; const_reference = const int&]' (did you forget the '()' ?)
16 | if(v[c].top == n-1){
| ()
|
s683312049 | p03645 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
int main(){
int n, m; scanf("%d %d", &n, &m);
vector<priority_queue<int>> v(n);
rep(i, m){
int a, b; scanf("%d %d", &a, &b); --a; --b;
v[a].push(b);
v[b].push(a);
}
bool b = 0;
for(int c: v[0]){
if(v[c].top == n-1){
b = 1;
break;
}
}
if(b) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:14:17: error: no matching function for call to 'begin(std::priority_queue<int>&)'
14 | for(int c: v[0]){
| ^
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
from /usr/include/c++/14/bits/stl_algo.h:59,
from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)'
88 | begin(initializer_list<_Tp> __ils) noexcept
| ^~~~~
/usr/include/c++/14/initializer_list:88:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: 'std::priority_queue<int>' is not derived from 'std::initializer_list<_Tp>'
14 | for(int c: v[0]){
| ^
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)'
52 | begin(_Container& __cont) -> decltype(__cont.begin())
| ^~~~~
/usr/include/c++/14/bits/range_access.h:52:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::priority_queue<int>]':
a.cc:14:17: required from here
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/bits/range_access.h:52:50: error: 'class std::priority_queue<int>' has no member named 'begin'
52 | begin(_Container& __cont) -> decltype(__cont.begin())
| ~~~~~~~^~~~~
/usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)'
63 | begin(const _Container& __cont) -> decltype(__cont.begin())
| ^~~~~
/usr/include/c++/14/bits/range_access.h:63:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::priority_queue<int>]':
a.cc:14:17: required from here
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/bits/range_access.h:63:56: error: 'const class std::priority_queue<int>' has no member named 'begin'
63 | begin(const _Container& __cont) -> decltype(__cont.begin())
| ~~~~~~~^~~~~
/usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])'
95 | begin(_Tp (&__arr)[_Nm]) noexcept
| ^~~~~
/usr/include/c++/14/bits/range_access.h:95:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: mismatched types '_Tp [_Nm]' and 'std::priority_queue<int>'
14 | for(int c: v[0]){
| ^
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)'
1227 | begin(valarray<_Tp>& __va) noexcept
| ^~~~~
/usr/include/c++/14/valarray:1227:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: 'std::priority_queue<int>' is not derived from 'std::valarray<_Tp>'
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)'
1238 | begin(const valarray<_Tp>& __va) noexcept
| ^~~~~
/usr/include/c++/14/valarray:1238:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: 'std::priority_queue<int>' is not derived from 'const std::valarray<_Tp>'
14 | for(int c: v[0]){
| ^
a.cc:14:17: error: no matching function for call to 'end(std::priority_queue<int>&)'
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: 'std::priority_queue<int>' is not derived from 'std::initializer_list<_Tp>'
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = std::priority_queue<int>]':
a.cc:14:17: required from here
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/bits/range_access.h:74:48: error: 'class std::priority_queue<int>' has no member named 'end'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = std::priority_queue<int>]':
a.cc:14:17: required from here
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/bits/range_access.h:85:54: error: 'const class std::priority_queue<int>' has no member named 'end'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: mismatched types '_Tp [_Nm]' and 'std::priority_queue<int>'
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
1249 | end(valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1249:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: 'std::priority_queue<int>' is not derived from 'std::valarray<_Tp>'
14 | for(int c: v[0]){
| ^
/usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
1265 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1265:5: note: template argument deduction/substitution failed:
a.cc:14:17: note: 'std::priority_queue<int>' is not derived from 'const std::valarray<_Tp>'
14 | for(int c: v[0]){
| ^
a.cc:15:13: error: invalid use of member function 'std::priority_queue<_Tp, _Sequence, _Compare>::const_reference std::priority_queue<_Tp, _Sequence, _Compare>::top() const [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>; const_reference = const int&]' (did you forget the '()' ?)
15 | if(v[c].top == n-1){
| ()
|
s192849489 | p03645 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;
int main(){
int n, m; scanf("%d %d", &n, &m);
vector<priority_queue> v(n);
rep(i, m){
int a, b; scanf("%d %d", &a, &b); --a; --b;
v[a].push(b);
v[b].push(a);
}
bool b = 0;
for(int c: v[0]){
if(v[c].top == n-1){
b = 1;
break;
}
}
if(b) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:7:24: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
7 | vector<priority_queue> v(n);
| ^
a.cc:7:24: note: expected a type, got 'priority_queue'
a.cc:7:24: error: template argument 2 is invalid
a.cc:10:6: error: invalid types 'int[int]' for array subscript
10 | v[a].push(b);
| ^
a.cc:11:6: error: invalid types 'int[int]' for array subscript
11 | v[b].push(a);
| ^
a.cc:14:15: error: invalid types 'int[int]' for array subscript
14 | for(int c: v[0]){
| ^
a.cc:15:9: error: invalid types 'int[int]' for array subscript
15 | if(v[c].top == n-1){
| ^
|
s060168324 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
ll n,m;
cin >> n >> m;
vl a(m),b(m);
rep(i,m){
cin >> a[i] >> b[i];
}
vl memo(2*m,INF);
ll j=0;
rep(i,m){
if(min(a[i],b[i])==1){
memo[j]=max(a[i],b[i]);
j++;
}
}
rep(i,m){
if(max(a[i],b[i])==n){
memo[j]=min(a[i],b[i]);
j++;
}
}
sort(memo.begin(),memo.end());
bool k=false;
rep(i,2*m){
if(memo[i]=INF)
break;
else(memo[i]==memo[i+1]){
k=true;
break;
}
}
if(k){
cout << "POSSIBLE" << endl;
}
else
cout << "IMPOSSIBLE" << endl;
} | a.cc: In function 'int main()':
a.cc:41:29: error: expected ';' before '{' token
41 | else(memo[i]==memo[i+1]){
| ^
| ;
|
s929476358 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
ll n,m;
cin >> n >> m;
vl a(m),b(m);
rep(i,m){
cin >> a[i] >> b[i];
}
vl memo(2*m,INF);
ll j=0;
rep(i,m){
if(min(a[i],b[i])==1){
memo[j]=max(a[i],b[i]);
j++;
}
}
rep(i,m){
if(max(a[i],b[i])==N){
memo[j]=min(a[i],b[i]);
j++;
}
}
sort(memo.begin(),memo.end());
bool a=false;
rep(i,2*m){
if(memo[i]=INF)
break;
else(memo[i]==memo[i+1]){
a=true;
break;
}
}
if(a){
cout << "POSSIBLE" << endl;
}
else
cout << "IMPOSSIBLE" << endl;
} | a.cc: In function 'int main()':
a.cc:31:24: error: 'N' was not declared in this scope
31 | if(max(a[i],b[i])==N){
| ^
a.cc:37:8: error: conflicting declaration 'bool a'
37 | bool a=false;
| ^
a.cc:18:6: note: previous declaration as 'vl a'
18 | vl a(m),b(m);
| ^
a.cc:41:29: error: expected ';' before '{' token
41 | else(memo[i]==memo[i+1]){
| ^
| ;
a.cc:46:6: error: could not convert 'a' from 'vl' {aka 'std::vector<long long int>'} to 'bool'
46 | if(a){
| ^
| |
| vl {aka std::vector<long long int>}
|
s808857659 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,M;
cin>>N>>M;
vector<pair<int,int>>A(M);
for(int i=0;i<M;i++){
int x,y;
cin>>x>>y;
A.at(i).first=x;
A.at(i).second=y;
}
set<int>S;
for(int i=0;i<M;i++){
if(A.at(i).first==1)
S.insert(A.at(i).second);
}
string ans="IMPOSSIBLE";
for(int i=0;i<M;i++){
if(A.at(i).second==N && S.count(A.at(i).first){
ans="POSSIBLE"; break;
}
}cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:49: error: expected ')' before '{' token
20 | if(A.at(i).second==N && S.count(A.at(i).first){
| ~ ^
| )
a.cc:23:5: error: expected primary-expression before '}' token
23 | }cout<<ans<<endl;
| ^
|
s522427767 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
class Dijkstra{ //O((N+M)logN)
private:
vector<vector<pair<int,long long>>> graph; //pair<next_path,cost>
vector<long long> total_cost;
public:
Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
priority_queue<
pair<int,long long>,
vector<pair<int,long long>>,
greater<pair<int,long long>>> q;
vector<long long> cost(size,1e18+7);
cost[start] = 0;
q.push(make_pair(start,0ll));
while (!q.empty()){
auto now = q.top();
q.pop();
int prev = now.first;
if( cost[prev] < now.second) continue;
for (auto next : graph[prev]){
if (cost[next.first] <= cost[now.first] + next.second) continue;
cost[next.first] = cost[now.first] + next.second;
q.push(next);
}
}
total_cost = cost;
}
long long get_cost(int goal){ return total_cost[goal]; }
};
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
int n,m; cin >> n >> m;
vector<vector<int,ll>> graph(n+1); //graph[i].first i:現在地,first:次の場所,second:コスト
rep(i,0,m){
int b1,b2; cin >> b1 >> b2;
graph[b2].push_back(make_pair(b1,1));
graph[b1].push_back(make_pair(b2,1));
}
Dijkstra G(graph,1,n+1);
if( G.get_cost(n) == 2)cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
} | In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<int, long long int>':
/usr/include/c++/14/bits/stl_vector.h:428:11: required from 'class std::vector<int, long long int>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
a.cc:46:18: required from here
46 | graph[b2].push_back(make_pair(b1,1));
| ^
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'long long int' is not a class, struct, or union type
87 | rebind<_Tp>::other _Tp_alloc_type;
| ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'long long int' is not a class, struct, or union type
89 | pointer;
| ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, long long int>':
a.cc:46:18: required from here
46 | graph[b2].push_back(make_pair(b1,1));
| ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, long long int>::_Base'
518 | using _Base::_M_allocate;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, long long int>::_Base'
519 | using _Base::_M_deallocate;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, long long int>::_Base'
521 | using _Base::_M_get_Tp_allocator;
| ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:46:28: error: no matching function for call to 'std::vector<int, long long int>::push_back(std::pair<int, int>)'
46 | graph[b2].push_back(make_pair(b1,1));
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = long long int; value_type = int]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<int, long long int>::value_type&' {aka 'const int&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = long long int; value_type = int]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int, long long int>::value_type&&' {aka 'int&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:47:28: error: no matching function for call to 'std::vector<int, long long int>::push_back(std::pair<int, int>)'
47 | graph[b1].push_back(make_pair(b2,1));
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = long long int; value_type = int]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<int, long long int>::value_type&' {aka 'const int&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = long long int; value_type = int]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int, long long int>::value_type&&' {aka 'int&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:49:27: error: no matching function for call to 'Dijkstra::Dijkstra(std::vector<std::vector<int, long long int> >&, int, int)'
49 | Dijkstra G(graph,1,n+1);
| ^
a.cc:10:9: note: candidate: 'Dijkstra::Dijkstra(std::vector<std::vector<std::pair<int, long long int> > >, int, int, bool)'
10 | Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
| ^~~~~~~~
a.cc:10:54: note: no known conversion for argument 1 from 'vector<vector<int,long long int>>' to 'vector<vector<std::pair<int, long long int>,std::allocator<std::pair<int, long long int> >>>'
10 | Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:4:7: note: candidate: 'Dijkstra::Dijkstra(const Dijkstra&)'
4 | class Dijkstra{ //O((N+M)logN)
| ^~~~~~~~
a.cc:4:7: note: candidate expects 1 argument, 3 provided
a.cc:4:7: note: candidate: 'Dijkstra::Dijkstra(Dijkstra&&)'
a.cc:4:7: note: candidate expects 1 argument, 3 provided
In file included from /usr/include/c++/14/cassert:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = int; _Alloc = long long int]':
/usr/include/c++/14/bits/stl_construct.h:119:7: required from 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = vector<int, long long int>; _Args = {}]'
119 | ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:643:18: required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = std::vector<int, long long int>*; _Size = long unsigned int; bool _TrivialValueType = false]'
643 | std::_Construct(std::__addressof(*__cur));
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:712:20: required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = vector<int, long long int>*; _Size = long unsigned int]'
710 | return __uninitialized_default_n_1<__is_trivial(_ValueType)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
711 | && __can_fill>::
| ~~~~~~~~~~~~~~~~
712 | __uninit_default_n(__first, __n);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:779:44: required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = vector<int, long long int>*; _Size = long unsigned int; _Tp = vector<int, long long int>]'
779 | { return std::__uninitialized_default_n(__first, __n); }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1720:36: required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; size_type = long unsigned int]'
1720 | std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1721 | _M_get_Tp_allocator());
| ~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:558:9: required from 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int, long long int> >]'
558 | { _M_default_initialize(__n); }
| ^~~~~~~~~~~~~~~~~~~~~
a.cc:43:37: required from here
43 | vector<vector<int,ll>> graph(n+1); //graph[i].first i:現在地,first:次の場所,second:コスト
| ^
/usr/include/c++/14/bits/stl_vector.h:136:24: error: 'long long int' is not a class, struct, or union type
136 | _Vector_impl() _GLIBCXX_NOEXCEPT_IF(
| ^~~~~~~~~~~~~~~~~~~~
|
s224910840 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
class Dijkstra{ //O((N+M)logN)
private:
vector<vector<pair<int,long long>>> graph; //pair<next_path,cost>
vector<long long> total_cost;
public:
Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
priority_queue<
pair<int,long long>,
vector<pair<int,long long>>,
greater<pair<int,long long>>> q;
vector<long long> cost(size,1e18+7);
cost[start] = 0;
q.push(make_pair(start,0ll));
while (!q.empty()){
auto now = q.top();
q.pop();
int prev = now.first;
if( cost[prev] < now.second) continue;
for (auto next : graph[prev]){
if (cost[next.first] <= cost[now.first] + next.second) continue;
cost[next.first] = cost[now.first] + next.second;
q.push(next);
}
}
total_cost = cost;
}
long long get_cost(int goal){ return total_cost[goal]; }
};
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
int n,m; cin >> n >> m;
vector<vector<int,ll>> graph[n+1]; //graph[i].first i:現在地,first:次の場所,second:コスト
rep(i,0,m){
int b1,b2; cin >> b1 >> b2;
graph[b2].push_back(make_pair(b1,1));
graph[b1].push_back(make_pair(b2,1));
}
Dijkstra G(graph,1,n+1);
if( G.get_cost(n) == 2)cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
} | In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<int, long long int>':
/usr/include/c++/14/bits/stl_vector.h:428:11: required from 'class std::vector<int, long long int>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
a.cc:46:28: required from here
46 | graph[b2].push_back(make_pair(b1,1));
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'long long int' is not a class, struct, or union type
87 | rebind<_Tp>::other _Tp_alloc_type;
| ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'long long int' is not a class, struct, or union type
89 | pointer;
| ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<int, long long int>':
a.cc:46:28: required from here
46 | graph[b2].push_back(make_pair(b1,1));
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<int, long long int>::_Base'
518 | using _Base::_M_allocate;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<int, long long int>::_Base'
519 | using _Base::_M_deallocate;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<int, long long int>::_Base'
521 | using _Base::_M_get_Tp_allocator;
| ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:46:28: error: no matching function for call to 'std::vector<std::vector<int, long long int> >::push_back(std::pair<int, int>)'
46 | graph[b2].push_back(make_pair(b1,1));
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<std::vector<int, long long int> >::value_type&' {aka 'const std::vector<int, long long int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<std::vector<int, long long int> >::value_type&&' {aka 'std::vector<int, long long int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:47:28: error: no matching function for call to 'std::vector<std::vector<int, long long int> >::push_back(std::pair<int, int>)'
47 | graph[b1].push_back(make_pair(b2,1));
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<std::vector<int, long long int> >::value_type&' {aka 'const std::vector<int, long long int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int, long long int>; _Alloc = std::allocator<std::vector<int, long long int> >; value_type = std::vector<int, long long int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<std::vector<int, long long int> >::value_type&&' {aka 'std::vector<int, long long int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:49:27: error: no matching function for call to 'Dijkstra::Dijkstra(std::vector<std::vector<int, long long int> > [(n + 1)], int, int)'
49 | Dijkstra G(graph,1,n+1);
| ^
a.cc:10:9: note: candidate: 'Dijkstra::Dijkstra(std::vector<std::vector<std::pair<int, long long int> > >, int, int, bool)'
10 | Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
| ^~~~~~~~
a.cc:10:54: note: no known conversion for argument 1 from 'std::vector<std::vector<int, long long int> > [(n + 1)]' to 'std::vector<std::vector<std::pair<int, long long int> > >'
10 | Dijkstra(vector<vector<pair<int,long long>>> graph,int start,int size,bool path_check = false){
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:4:7: note: candidate: 'Dijkstra::Dijkstra(const Dijkstra&)'
4 | class Dijkstra{ //O((N+M)logN)
| ^~~~~~~~
a.cc:4:7: note: candidate expects 1 argument, 3 provided
a.cc:4:7: note: candidate: 'Dijkstra::Dijkstra(Dijkstra&&)'
a.cc:4:7: note: candidate expects 1 argument, 3 provided
|
s775192723 | p03645 | Java |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] num = new num[n];
for(int i = 0; i < m; i++) {
int a = sc.nextInt() - 1;
int b = sc.nextInt() - 1;
if(a == 0) num[b]++;
if(b == (n - 1)) num[a]++;
}
String ans = "IMPOSSIBLE";
for(int i = 0; i < n; i++) {
if(num[i] > 1) ans = "POSSIBLE";
}
System.out.println(ans);
}
} | Main.java:9: error: cannot find symbol
int[] num = new num[n];
^
symbol: class num
location: class Main
1 error
|
s039928597 | p03645 | C++ | #pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define PER(i, n) for (int i = (n-1); i >= 0; --i)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NEXP(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define popb(n) pop_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define yes(n) cout << ((n) ? "yes" : "no" ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {if((V).size()-1!=i){cout << (V)[i] << " ";}else{cout << (V)[i] << endl;}}
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
using ll = long long;
using Graph = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
class UnionFind {
public:
vector <int> par;
vector <int> siz;
UnionFind(int sz_): par(sz_), siz(sz_, 1LL) {
for (int i = 0; i < sz_; ++i) par[i] = i;
}
void init(ll sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL);
for (int i = 0; i < sz_; ++i) par[i] = i;
}
int root(int x) {
while (par[x] != x) {
x = par[x] = par[par[x]];
}
return x;
}
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return false;
if (siz[x] < siz[y]) swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(int x, int y) {
return root(x) == root(y);
}
int size(int x) {
return siz[root(x)];
}
};
int gcd(int a, int b) {
return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
// 文字を全て大文字にします
string toStrUp(string str) {
char diff = 'A'-'a';
REP(i,str.size()) str[i] += diff;
return str;
}
// 文字をstring型で一文字取得します
string get1ch(string str, int key) {
return str.substr(key,1);
}
// 素因数分解 (O(sqrt(n)))
map<int,int> prime_factor(int n) {
map<int,int> ret;
for(int i = 2; i * i <= n; i++) {
while(n % i == 0) {
ret[i]++;
n /= i;
}
}
if(n != 1) ret[n] = 1;
return ret;
}
// 素数判定 (O(sqrt(n)))
bool is_prime(int x) {
for(int i = 2; i * i <= x; i++) {
if(x % i == 0) return false;
}
return true;
}
// 進数変換 (O(log n))
template<typename T>
vector<T> convert_base(T x, T b) {
vector< T > ret;
T t = 1, k = abs(b);
while(x) {
ret.emplace_back((x * t) % k);
if(ret.back() < 0) ret.back() += k;
x -= ret.back() * t;
x /= k;
t *= b / k;
}
if(ret.empty()) ret.emplace_back(0);
reverse(begin(ret), end(ret));
return ret;
}
template<class T> inline bool chmin(T& a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if(a < b){
a = b;
return true;
}
return false;
}
int N;
int M;
Graph G(200000);
bool ok = false;
bool seen[3][200000];
void dfs(int rct, int now){
seen[rct][now] = true;
if(rct == 0) {
if(now == N-1) ok=true;
else seen[now] = true;
return;
} else {
REP(i,M) {
if(G[i][0] == seen[rct][now]) continue;
if(G[i][0] == now) dfs(rct-1, G[i][1]);
}
}
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
// デフォルト変数定義
int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
string s="",t="";
//
// ここから
IN2(N,M);
REP(i,M) {
IN2(a,b);
--a;--b;
Vi tmp{a,b};
G[i] = tmp;
}
dfs(2, 0);
if(ok) OUT("POSSIBLE");
else OUT("IMPOSSIBLE");
}
| a.cc: In function 'void dfs(long long int, long long int)':
a.cc:179:20: error: incompatible types in assignment of 'bool' to 'bool [200000]'
179 | else seen[now] = true;
| ~~~~~~~~~~^~~~~~
|
s523970724 | p03645 | C++ | #pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define PER(i, n) for (int i = (n-1); i >= 0; --i)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NEXP(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define popb(n) pop_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define yes(n) cout << ((n) ? "yes" : "no" ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {if((V).size()-1!=i){cout << (V)[i] << " ";}else{cout << (V)[i] << endl;}}
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
using ll = long long;
using Graph = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
class UnionFind {
public:
vector <int> par;
vector <int> siz;
UnionFind(int sz_): par(sz_), siz(sz_, 1LL) {
for (int i = 0; i < sz_; ++i) par[i] = i;
}
void init(ll sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL);
for (int i = 0; i < sz_; ++i) par[i] = i;
}
int root(int x) {
while (par[x] != x) {
x = par[x] = par[par[x]];
}
return x;
}
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return false;
if (siz[x] < siz[y]) swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(int x, int y) {
return root(x) == root(y);
}
int size(int x) {
return siz[root(x)];
}
};
int gcd(int a, int b) {
return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
// 文字を全て大文字にします
string toStrUp(string str) {
char diff = 'A'-'a';
REP(i,str.size()) str[i] += diff;
return str;
}
// 文字をstring型で一文字取得します
string get1ch(string str, int key) {
return str.substr(key,1);
}
// 素因数分解 (O(sqrt(n)))
map<int,int> prime_factor(int n) {
map<int,int> ret;
for(int i = 2; i * i <= n; i++) {
while(n % i == 0) {
ret[i]++;
n /= i;
}
}
if(n != 1) ret[n] = 1;
return ret;
}
// 素数判定 (O(sqrt(n)))
bool is_prime(int x) {
for(int i = 2; i * i <= x; i++) {
if(x % i == 0) return false;
}
return true;
}
// 進数変換 (O(log n))
template<typename T>
vector<T> convert_base(T x, T b) {
vector< T > ret;
T t = 1, k = abs(b);
while(x) {
ret.emplace_back((x * t) % k);
if(ret.back() < 0) ret.back() += k;
x -= ret.back() * t;
x /= k;
t *= b / k;
}
if(ret.empty()) ret.emplace_back(0);
reverse(begin(ret), end(ret));
return ret;
}
template<class T> inline bool chmin(T& a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if(a < b){
a = b;
return true;
}
return false;
}
int N;
int M;
Graph G(200000);
bool ok = false;
bool seen[200000];
void dfs(int rct, int now){
if(seen[now]) return;
if(rct == 0) {
if(now == N-1) ok=true;
else seen[now] = true;
return;
} else {
REP(i,M) {
if(G[i][0] == now) dfs(rct-1, G[i][1]);
}
}
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(15);
// デフォルト変数定義
int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
string s="",t="";
//
// ここから
IN2(N,M);
REP(i,M) {
IN2(a,b);
--a;--b;
G[i].pb({a,b});
}
dfs(2, 0);
if(ok) OUT("POSSIBLE");
else OUT("IMPOSSIBLE");
}
| a.cc:203:18: error: macro "pb" passed 2 arguments, but takes just 1
203 | G[i].pb({a,b});
| ^
a.cc:13:9: note: macro "pb" defined here
13 | #define pb(n) push_back(n)
| ^~
a.cc: In function 'int main()':
a.cc:203:10: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'pb'
203 | G[i].pb({a,b});
| ^~
|
s471515043 | p03645 | C++ | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
| |
s715606962 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;
int main(){
ll n, a;
in2(n, m);
vector<ll> c(m), d(m), e(n);
rep(i, m){
in(a);
c[i] = a - 1;
in(a);
d[i] = a - 1;
}
rep(i, m){
if(c[i] == 0)
e[d[i]]++;
if(d[i] == n - 1)
e[c[i]]++;
}
a = 0;
rep(i, n){
if(e[i] == 2)
a++;
}
if(a)
out("POSSIBLE");
else
out("IMPOSSIBLE");
memi;
} | a.cc: In function 'int main()':
a.cc:19:10: error: 'm' was not declared in this scope
19 | in2(n, m);
| ^
a.cc:12:31: note: in definition of macro 'in2'
12 | #define in2(n, m) cin >> n >> m
| ^
|
s051699254 | p03645 | C++ | #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
//#define N 1000000007
using namespace std;
int main(){
lli n,m,a,b;
lli i;
string ans="IMPOSSIBLE";
vector<lli> v,w;
cin>>n>>m;
bool s[n],g[n];
rep(i,0,n){
s[i]=false;
g[i]=false;1
}
rep(i,0,m){
cin>>a>>b;
if(a==1){
s[b-1]=true;
}
if(b==n){
g[a-1]=true;
}
}
rep(i,0,n){
if((s[i]==true)&&(g[i]==true)){
ans="POSSIBLE";
break;
}
}
cout<<ans<<endl;
}
| a.cc: In function 'int main()':
a.cc:27:21: error: expected ';' before '}' token
27 | g[i]=false;1
| ^
| ;
28 | }
| ~
|
s200657910 | p03645 | C++ | int main ()
{
int n, m;
cin>>n>>m;
vector<bool>vis(n+1,false);
bool ans=false;
for(int i = 0; i < m; i++)
{
int a, b ;
cin>>a>>b ;
assert(1<=a && a<b && b<=n);
if(a == 1)
{
if(vis[b])
ans = true;
vis[b] = true;
}
else if(b == n)
{
if(vis[a])
ans = true;
vis[a] = true;
}
}
if(!ans)
cout<<"IM";
cout<<"POSSIBLE"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
4 | cin>>n>>m;
| ^~~
a.cc:5:5: error: 'vector' was not declared in this scope
5 | vector<bool>vis(n+1,false);
| ^~~~~~
a.cc:5:12: error: expected primary-expression before 'bool'
5 | vector<bool>vis(n+1,false);
| ^~~~
a.cc:11:9: error: 'assert' was not declared in this scope
11 | assert(1<=a && a<b && b<=n);
| ^~~~~~
a.cc:1:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
+++ |+#include <cassert>
1 | int main ()
a.cc:14:16: error: 'vis' was not declared in this scope
14 | if(vis[b])
| ^~~
a.cc:16:13: error: 'vis' was not declared in this scope
16 | vis[b] = true;
| ^~~
a.cc:20:16: error: 'vis' was not declared in this scope
20 | if(vis[a])
| ^~~
a.cc:22:13: error: 'vis' was not declared in this scope
22 | vis[a] = true;
| ^~~
a.cc:26:9: error: 'cout' was not declared in this scope
26 | cout<<"IM";
| ^~~~
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout<<"POSSIBLE"<<endl;
| ^~~~
a.cc:27:23: error: 'endl' was not declared in this scope
27 | cout<<"POSSIBLE"<<endl;
| ^~~~
|
s434620801 | p03645 | C++ | int main ()
{
int n, m;
cin>>n>>m;
vector<bool>vis(n+1,false);
bool ans=false;
for(int i = 0; i < m; i++)
{
int a, b ;
cin>>a>>b ;
assert(1<= a && a < b && b <= n);
if(a == 1)
{
if(vis[b])
ans = true;
vis[b] = true;
}
else if(b == n)
{
if(vis[a])
ans = true;
vis[a] = true;
}
}
if(!ans)
cout<<"IM";
cout<<"POSSIBLE"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
4 | cin>>n>>m;
| ^~~
a.cc:5:5: error: 'vector' was not declared in this scope
5 | vector<bool>vis(n+1,false);
| ^~~~~~
a.cc:5:12: error: expected primary-expression before 'bool'
5 | vector<bool>vis(n+1,false);
| ^~~~
a.cc:11:9: error: 'assert' was not declared in this scope
11 | assert(1<= a && a < b && b <= n);
| ^~~~~~
a.cc:1:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
+++ |+#include <cassert>
1 | int main ()
a.cc:14:16: error: 'vis' was not declared in this scope
14 | if(vis[b])
| ^~~
a.cc:16:13: error: 'vis' was not declared in this scope
16 | vis[b] = true;
| ^~~
a.cc:20:16: error: 'vis' was not declared in this scope
20 | if(vis[a])
| ^~~
a.cc:22:13: error: 'vis' was not declared in this scope
22 | vis[a] = true;
| ^~~
a.cc:26:9: error: 'cout' was not declared in this scope
26 | cout<<"IM";
| ^~~~
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout<<"POSSIBLE"<<endl;
| ^~~~
a.cc:27:23: error: 'endl' was not declared in this scope
27 | cout<<"POSSIBLE"<<endl;
| ^~~~
|
s413957638 | p03645 | C++ | #include<cstdio>
#include<iostream>
int a[1000010],b[1000010];
int n,m,i;
int c,d;
int main()
{
cin>>n>>m;
for(i=1;i<=m;i++)
{
scanf("%d%d",&c,&d);
if(c==1)a[d]=1;
if(d==n)b[c]=1;
}
for(i=1;i<=m;i++)
if(a[i]==1&&b[i]==1)
{
printf("POSSIBLE\n");
return 0;
}
printf("IMPOSSIBLE\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
8 | cin>>n>>m;
| ^~~
| std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s614162091 | p03645 | C++ | /*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll Len(ll n) {
ll s=0;
while(n!=0) s++, n/=10;
return s;
}
ll Sint(ll n) {
ll m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
return m;
}
ll Svec(vector<ll> v){
ll n=0;
for(ll i=0;i<v.size();i++) n+=v[i];
return n;
}
ll GCD(ll a,ll b) {
return b ? GCD(b,a%b) : a;
}
ll LCM(ll a,ll b){
return a/GCD(a,b)*b;
}
ll Factorial(ll n){
ll m=1;
while(n>=1) m*=n,n--;
return m;
}
void runlength(string s,vector<pair<char,ll>> &p){
ll x=1;
if(s.size()==1){
p.push_back(pair<char,ll>(s[0],1));
}
for(ll i=0;i<s.size()-1;i++){
if(s[i]==s[i+1]){
x++;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[i],x));
}
}else{
p.push_back(pair<char,ll>(s[i],x));
x=1;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[s.size()-1],x));
}
}
}
}
ll COM(ll n,ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
vector<bool> isPrime(MAX_N+1,true);
for(int i=2;i<=MAX_N;i++){
if(isPrime[i]){
for(int j=2*i;j<=MAX_N;j+=i){
isPrime[j]=false;
}
}
}
return isPrime;
}
vector<pint> prime_factorize(ll n){
vector<pint> ans;
for(ll p=2;p<=sqrt(n);p++){
if(n%p!=0) continue;
ll cnt=0;
while(n%p==0){
n/=p;
cnt++;
}
ans.push_back(make_pair(p,cnt));
}
if(n!=1) ans.push_back(make_pair(n,1));
return ans;
}
/* ダイクストラ法 */
const int MAX_V=200010;
struct edge{ll to,cost;};
typedef pair<ll,ll> pint;
ll n;
ll INF=1e12;
vector<edge> graph[MAX_V];
ll dist[MAX_V];
void dijkstra(ll s){
priority_queue<pint,vector<pint>,greater<pint>> que;
fill(dist,dist+n,INF);
dist[s]=0;
que.push(pint(0,s));
while(!que.empty()){
auto p=que.top();que.pop();
ll v=p.second;
if(dist[v]<p.first) continue;
for(auto e:graph[v]){
if(dist[e.to]>dist[v]+e.cost){
dist[e.to]=dist[v]+e.cost;
que.push(pint(dist[e.to],e.to));
}
}
}
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
IOS;
ll m;
cin>>n>>m;
rep(i,m){
ll a,b;cin>>a>>b;a--;b--;
graph[a].push_back(edge{b,1});
graph[b].push_back(edge{a,1});
}
dijkstra(a);
if(dist[n-1]==2) cout<<"POSSIBLE"<<endl;
else cout<<"IMPOSSIBLE"<<endl;
} | a.cc: In function 'int main()':
a.cc:173:12: error: 'a' was not declared in this scope
173 | dijkstra(a);
| ^
|
s171456187 | p03645 | C++ | #pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define yes(n) cout << ((n) ? "yes" : "no" ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//
template<class T> inline bool chmin(T& a, T b) {if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if(a<b){a=b;return true;}return false;}
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}
signed main() {
RAPID;
// デフォルト変数定義
int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
string s="",t="";
//
// ここから
IN2(n,m);
Vi A(m);
Vi B(m);
REP(i,m){
IN2(A[i],B[i]);
}
Vi V1;
Vi V2;
REP(i,m){
if(A[i]==1 && B[i]!=n) V1.pb(B[i]);
}
REP(i,m){
if(B[i]==n && A[i]!=1) V2.pb(A[i]);
}
Vi result;
set_intersection(V1.begin(), V1.end(),
V2.begin(), V2.end(),
inserter(result, result.end()));
if(result.size()==0) OUT("IMPOSSIBLE");
else OUT("POSSIBLE");
} | a.cc:80:14: error: extended character is not valid in an identifier
80 | if(A[i]==1 && B[i]!=n) V1.pb(B[i]);
| ^
a.cc: In function 'int main()':
a.cc:80:14: error: unable to find numeric literal operator 'operator""\U00003000'
80 | if(A[i]==1 && B[i]!=n) V1.pb(B[i]);
| ^~~
|
s047580723 | p03645 | C++ | d | a.cc:1:1: error: 'd' does not name a type
1 | d
| ^
|
s453221389 | p03645 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
boolean[] one_to_i = new boolean[N+1];
boolean[] i_to_n = new boolean[N+1];
tmpa = 0;
tmpb = 0;
for(int i=0;i<M;i++)
{
tmpa = sc.nextInt();
tmpb = sc.nextInt();
if(tmpa==1) one_to_i[tmpb] = true;
if(tmpb==N) i_to_n[tmpa] = true;
}
boolean forans = false;
String ans = "IMPOSSIBLE";
for(int i=1;i<N;i++)
{
if(one_to_i[i])
{
if(i_to_n[i])
{
forans = true;
break;
}
}
}
if(forans) ans = "POSSIBLE";
System.out.println(ans);
}
} | Main.java:10: error: cannot find symbol
tmpa = 0;
^
symbol: variable tmpa
location: class Main
Main.java:11: error: cannot find symbol
tmpb = 0;
^
symbol: variable tmpb
location: class Main
Main.java:14: error: cannot find symbol
tmpa = sc.nextInt();
^
symbol: variable tmpa
location: class Main
Main.java:15: error: cannot find symbol
tmpb = sc.nextInt();
^
symbol: variable tmpb
location: class Main
Main.java:16: error: cannot find symbol
if(tmpa==1) one_to_i[tmpb] = true;
^
symbol: variable tmpa
location: class Main
Main.java:16: error: cannot find symbol
if(tmpa==1) one_to_i[tmpb] = true;
^
symbol: variable tmpb
location: class Main
Main.java:17: error: cannot find symbol
if(tmpb==N) i_to_n[tmpa] = true;
^
symbol: variable tmpb
location: class Main
Main.java:17: error: cannot find symbol
if(tmpb==N) i_to_n[tmpa] = true;
^
symbol: variable tmpa
location: class Main
8 errors
|
s897122899 | p03645 | C++ | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD=1000000007;
//scanf("%d", &a); '\n';
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<pair<int, int>> p(m), q(m);
rep(i, m) {
int a, b;
cin >> a >> b;
p.at(i) = make_pair(a, b);
int c, d;
tie(d, c) = p.at(i);
q.at(i) = make_pair(c, d);
}
sort(q.begin(), q.end());
auto it = lower_bound(q.begin(), q.end(), n);
int index = it - q.begin();
sort(p.begin(), p.end());
rep2(i,index, m) {
if (q[i].first > n) {puts("INPOSSIBLE"); return 0; }
if (q[i].first == n) {
int j = 0;
while (p[j].first == 1) {
if (p[j].second == q[i].second) { puts("POSSIBLE"); return 0; }
++j;
}
}
}
puts("INPOSSIBLE");
}
| In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Value = const int]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<int, int>*, vector<pair<int, int> > >; _Tp = int; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<int, int>*, vector<pair<int, int> > >; _Tp = int]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:35:23: required from here
35 | auto it = lower_bound(q.begin(), q.end(), n);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<int, int>' and 'const int')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::pair<_T1, _T2>' and 'const int'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mi |
s457168103 | p03645 | C++ | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD=1000000007;
//scanf("%d", &a); '\n';
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<pair<int, int>> p(m), q(m);
rep(i, m) {
int a, b;
cin >> a >> b;
p.at(i) = make_pair(a, b);
int c, d;
tie(d, c) = p.at(i);
q.at(i) = make_pair(c, d);
}
sort(q.begin(), q.end());
sort(p.begin(), p.end());
int index = lower_bound(q.begin(), q.end(), n) - q.begin();
rep2(i,index, m) {
if (q[i].first > n) {cout << "IMPOSSIBLE"; return 0; }
if (q[i].first == n) {
int j = 0;
while (p[j].first == 1) {
if (p[j].second == q[i].second) { cout << "POSSIBLE"; return 0; }
++j;
}
}
}
cout << "IMPOSSIBLE"<<endl;
}
| In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_less_val::operator()(_Iterator, _Value&) const [with _Iterator = __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >; _Value = const int]':
/usr/include/c++/14/bits/stl_algobase.h:1504:14: required from '_ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<int, int>*, vector<pair<int, int> > >; _Tp = int; _Compare = __gnu_cxx::__ops::_Iter_less_val]'
1504 | if (__comp(__middle, __val))
| ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1539:32: required from '_ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<pair<int, int>*, vector<pair<int, int> > >; _Tp = int]'
1539 | return std::__lower_bound(__first, __last, __val,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
1540 | __gnu_cxx::__ops::__iter_less_val());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:36:25: required from here
36 | int index = lower_bound(q.begin(), q.end(), n) - q.begin();
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:69:22: error: no match for 'operator<' (operand types are 'std::pair<int, int>' and 'const int')
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'const std::pair<_T1, _T2>' and 'const int'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:69:22: note: 'std::pair<int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
69 | { return *__it < __val; }
| ~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3901 | operator<(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/predefined_ops.h:6 |
s541728519 | p03645 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int n,m;cin >> n >> m;
vector<int> x;
bool f=false;
for(int i=0;i<m;i++){
int a,b;cin >> a >>b;
if(a==1){
if(find(x.begin(),x.end(),b)!=x.end()){
cout << "POSSIBLE" << endl;f=true;break;
}else{
x.push_back(b);
}
}
if(b==n){
if(find(x.begin(),x.end(),a)!=x.end()){
cout << "POSSIBLE" << endl;f=true;break;
}else{
x.push_back(a);
}
}
}
if(!f){cout << "IMPOSSIBLE" << endl;}
}
| a.cc: In function 'int main()':
a.cc:12:14: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
12 | if(find(x.begin(),x.end(),b)!=x.end()){
| ~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:12:14: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
12 | if(find(x.begin(),x.end(),b)!=x.end()){
| ~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:19:14: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
19 | if(find(x.begin(),x.end(),a)!=x.end()){
| ~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:19:14: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
19 | if(find(x.begin(),x.end(),a)!=x.end()){
| ~~~~^~~~~~~~~~~~~~~~~~~~~
|
s441519351 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(200002, 0);
string out;
for(int i = 0; i < m; i++){
int c, d;
cin >> c >> d;
if(c == 1) a.at(d)++;
if(d == n) b.at(c)++;
if(a.at(d) == 2){
out = "POSSIBLE";
}
if(a.at(c) == 2){
out = "POSSIBLE";
}
}
out = "IMPOSSIBLE";
cout << out;
} | a.cc: In function 'int main()':
a.cc:13:16: error: 'b' was not declared in this scope
13 | if(d == n) b.at(c)++;
| ^
|
s654396599 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(200002, 0);
for(int i = 0; i < m; i++){
int c, d;
cin >> c >> d;
if(c == 1) a.at(d)++;
if(d == n) b.at(c)++;
if(a.at(d) == 2){
cout << "POSSIBLE";
return 0;
}
if(a.at(c) == 2){
cout << "POSSIBLE";
return 0;
}
}
cout << "IMPOSSIBLE";
} | a.cc: In function 'int main()':
a.cc:12:16: error: 'b' was not declared in this scope
12 | if(d == n) b.at(c)++;
| ^
|
s824213297 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(200002, 0), b(200002, 0);
for(int i = 0; i < m; i++){
int c, d;
cin >> c >> d;
if(c == 1) a.at(d) = 1;
if(d == n) a.at(c) = 1;
}
for(int i = 0; i < 200002; i++){
if(c.at(i) + d.at(i) == 2){
cout << "POSSIBLE";
return 0;
}
}
cout << "IMPOSSIBLE";
}
| a.cc: In function 'int main()':
a.cc:15:8: error: 'c' was not declared in this scope
15 | if(c.at(i) + d.at(i) == 2){
| ^
a.cc:15:18: error: 'd' was not declared in this scope
15 | if(c.at(i) + d.at(i) == 2){
| ^
|
s411390146 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
priority_queue<int> a, b;
for(int i = 0; i < m; i++){
int c, d;
cin >> c >> d;
if(c == 1) b.push(d);
if(d == n) a.push(-c);
}
vector<int> e;
while(!a.empty()){
e.push_back(-a.top());
a.pop;
}
while(!b.empty()){
for(int i = e.size() - 1; i > 0; i--){
if(e.at(i) == b.top()){
cout << "POSSIBLE";
return 0;
}else if(e.at(i) > b.top()){
b.pop();
break;
}
}
}
cout << "IMPOSSIBLE";
}
| a.cc: In function 'int main()':
a.cc:17:7: error: invalid use of non-static member function 'void std::priority_queue<_Tp, _Sequence, _Compare>::pop() [with _Tp = int; _Sequence = std::vector<int>; _Compare = std::less<int>]'
17 | a.pop;
| ~~^~~
In file included from /usr/include/c++/14/queue:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:771:7: note: declared here
771 | pop()
| ^~~
|
s714817879 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<pair<int, int>> p(m), P(m);
for(int i = 0; i < m; i++){
cin >> p.at(i).first >> p.at(i).second;
P.at(i).second = p.at(i).first;
P.at(i).first = p.at(i).second;
}
sort(p.begin(), p.end());
vector<int> c;
for(int i = 0; i < m; i++){
if(p.at(i).first != 1) break;
c.push(p.at(i).second);
}
sort(P.begin(), P.end());
vector<int> d;
for(int i = m - 1; i > -1; i--){
if(P.at(i).first != n) break;
d.push(P.at(i).second);
}
for(int i = 0; i < c.size(); i++){
for(int j : d){
if(c.at(i) == j){
cout << "POSSIBLE";
return 0;
}
if(i == c.size() - 1){
cout << "IMPOSSIBLE";
}
}
}
}
| a.cc: In function 'int main()':
a.cc:17:7: error: 'class std::vector<int>' has no member named 'push'
17 | c.push(p.at(i).second);
| ^~~~
a.cc:23:7: error: 'class std::vector<int>' has no member named 'push'
23 | d.push(P.at(i).second);
| ^~~~
|
s401580426 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
queue <int>x,y;
int n,m;
cin >> n >> m;
int a[n];
int b[n];
int i;
int chk = 0;
for(i=0;i<n;i++){
cin >> a[i] >> b[i];
if(a[i]==1)x.push(b[i]);
}
for(i=0;i<n;i++){
if(b[i]==n){
y=x;
while(!y.enpty()){
if(y.front()==a[i]){
chk = 1;
i=1000000;
break;
}
y.pop();
}
}
}
if(chk==1)cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
} | a.cc: In function 'int main()':
a.cc:18:16: error: 'class std::queue<int>' has no member named 'enpty'; did you mean 'empty'?
18 | while(!y.enpty()){
| ^~~~~
| empty
|
s629405111 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
int main(void)
{
IOS
int n, m;
cin >> n >> m;
map<int,bool> s,g;
REP(i,m){
int a, b;
cin >> a >> b;
if (a == 1) s[b] = true;
if (b == n) g[a] = true;
}
bool ans = false;
for(auto x:s) {
if (g[x.first]) {
ans = true;
break;
}
string str = ans ? "POSSIBLE" : "IMPOSSIBLE";
cout << str << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:15:1: note: to match this '{'
15 | {
| ^
|
s890459284 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
int main(void)
{
IOS
int n, m;
cin >> n >> m;
vector<vector<int>> g(n);
map<int,bool> s,g;
REP(i,m){
int a, b;
cin >> a >> b;
if (a == 1) s[b] = true;
if (b == n) g[a] = true;
}
bool ans = false;
for(auto x:s) {
if (g[x.first]) {
ans = true;
break;
}
string str = ans ? "POSSIBLE" : "IMPOSSIBLE";
cout << str << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:21: error: conflicting declaration 'std::map<int, bool> g'
20 | map<int,bool> s,g;
| ^
a.cc:19:25: note: previous declaration as 'std::vector<std::vector<int> > g'
19 | vector<vector<int>> g(n);
| ^
a.cc:25:28: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} and 'bool')
25 | if (b == n) g[a] = true;
| ^~~~
In file included from /usr/include/c++/14/vector:72,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'bool' to 'const std::vector<int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'bool' to 'std::vector<int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'bool' to 'std::initializer_list<int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:31:23: error: could not convert 'g.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)((int)x.std::pair<const int, bool>::first)))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool'
31 | if (g[x.first]) {
| ^
| |
| __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}
a.cc:40:2: error: expected '}' at end of input
40 | }
| ^
a.cc:15:1: note: to match this '{'
15 | {
| ^
|
s146765955 | p03645 | C++ | #include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <ctime>
#include <climits>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <cstdlib>
using namespace std;
long int pow107 = (int)pow(10, 9) + 7;
int ilimit = INT_MAX;
long int llimit = LONG_MAX;
bool comp(pair<int, int> a, pair<int, int> b){
if(a.first != b.first) return a.first > b.first;
else return a.second < b.second;
}
long int jou(long int x, long int y){
long int f = 1;
for(int i = 0; i < y; ++i){
f = f * x % pow107;
}
return f;
}
bool pn(long int x){
if(x != 2 && x % 2 == 0)
return false;
for(int i = 3; i < x; ++i){
if(x != i && x % i == 0)
return false;
}
return true;
}
long int factorial(long int n){
long int f = 1;
for(long int i = 1; i <= n; ++i){
f = f * i % pow107;
}
return f;
}
int Func2(int n,int m){
long int s2 = 1,
r = 1;
for(int i = 1; i <= m; ++i){
s2 = (s2*(n - (i - 1))/i) % pow107;
}
return s2;
}
//long intの最大llimit
//intの最大ilimit
//10^9+7 pow107
//素数pn
//n乗jou
//階乗factorial
//コンビネーションFunc2
int main(){
vector<pair<int,int> > v;
int n,m;
cin >> n >> m;
for(int i = 0; i < m ; ++i){
int a,b;
cin >> a >> b;
v.push_back(make_pair(b,a));
}
sort(v.begin(),v.end(),comp;
for(int i = 0; i < m; ++i){
if(v[i].first != n){
break;
}
if(v[i].second == 1){
cout << "POSSIBLE" << endl;
return 0;
}
for(int j = 0; j < m; ++j){
if(v[i].second == v[j].first){
if(v[j].second == 1){
cout << "POSSIBLE" << endl;
return 0;
}
}
}
}
cout << "IMPOSSIBLE" << endl;
} | a.cc: In function 'int main()':
a.cc:80:32: error: expected ')' before ';' token
80 | sort(v.begin(),v.end(),comp;
| ~ ^
| )
|
s958223074 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;
int main()
{
int n,m;
cin>>n>>m;
vector<pair<int,int>> a_n,b_1;
REP(i,m){
int temp_a,temp_b;
cin>>temp_a>>temp_b;
if(temp_a==1) b.emplace_back(b);
if(temp_b==n) a.emplace_back(a);
}
REP(i,a.size()){
REP(j,b.size()){
if(a[i]==b[j]){
cout<<"POSSIBLE"<<endl;
return 0;
}
}
}
cout<<"IMPOSSIBLE"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:19: error: 'b' was not declared in this scope
17 | if(temp_a==1) b.emplace_back(b);
| ^
a.cc:18:19: error: 'a' was not declared in this scope
18 | if(temp_b==n) a.emplace_back(a);
| ^
a.cc:21:9: error: 'a' was not declared in this scope
21 | REP(i,a.size()){
| ^
a.cc:3:33: note: in definition of macro 'REP'
3 | #define REP(i,n) for(int i=0;i<(n);i++)
| ^
a.cc:22:11: error: 'b' was not declared in this scope
22 | REP(j,b.size()){
| ^
a.cc:3:33: note: in definition of macro 'REP'
3 | #define REP(i,n) for(int i=0;i<(n);i++)
| ^
|
s099234378 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;
int main()
{
int n,m;
cin>>n>>m;
vector<pair<int,int>> p;
REP(i,m){
int a,b;
cin>>a>>b;
if(a==1 || b==n) p[i].emplace_back(make_pair(a,b));
}
int l=p.size();
REP(i,l){
if(p[i].second==n){
REP(j,l){
if(p[j].second==p[i].first && p[j].first==1){
cout<<"POSSIBLE"<<endl;
return 0;
}
}
}
}
cout<<"IMPOSSIBLE"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:17:27: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'emplace_back'
17 | if(a==1 || b==n) p[i].emplace_back(make_pair(a,b));
| ^~~~~~~~~~~~
|
s075373212 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
// nがbc.at(a)とbc.at(b)の間に存在するか、二分探索
bool search2(int n, vector<int> &bc, int a, int b){
// 二分探索なので中間をとる。中間と一致すればok
int c = a + (b-a)/2;
if (n == bc.at(c)){
return true;
}else if (n > bc.at(c)){
//中間よりでかいならもっと右だが、右がないならサヨナラ
if (c+1 == bc.size()){
return false;
}else{
return search2(n, bc, c+1, b);
}
}else if (n < bc.at(c)){
//中間より小さいならもっと左だが、左がないならサヨナラ
if (c-1 == -1){
return false;
}else{
return search2(n, bc, a, c-1);
}
}
}
// nがbcの中に存在するか
bool search(int n, vector<int> &bc){
return search2(n, bc, 0, bc.size()-1);
}
int main() {
int n,m; cin >>n >>m;
vector<int> a(m), b(m);
vector<int> ac, bc;
for (int i=0; i<m; i++){
cin >>a.at(i) >>b.at(i);
if (a.at(i)==1) ac.push_back(b.at(i));
if (b.at(i)==n) bc.push_back(a.at(i));
}
sort(ac.begin(), ac.end());
sort(bc.begin(), bc.end());
//acには島1から行ける島を突っ込んでソート
//bcには島Nに行ける島を突っ込んでソート
//ac,bcに共通する島があればいける
bool possible;
if (ac.size()*bc.size()==0){
possible=false; // 便通ってなかったら無理
}else{
for (int i=0; i<ac.size(); i++){
if (i!=0 && i=i-1){
continue;
}
//acの要素がbc内にあればok
if (search(ac.at(i),bc)){
possible=true;
break;
}
}
}
if(possible) cout <<"POSSIBLE" <<endl;
else cout <<"IMPOSSIBLE" <<endl;
}
| a.cc: In function 'int main()':
a.cc:52:16: error: lvalue required as left operand of assignment
52 | if (i!=0 && i=i-1){
| ~~~~~^~~~
a.cc: In function 'bool search2(int, std::vector<int>&, int, int)':
a.cc:25:1: warning: control reaches end of non-void function [-Wreturn-type]
25 | }
| ^
|
s538377980 | p03645 | C++ | /*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
int Len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int Sint(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int GCD(int a,int b)
{
int r, tmp;
/* 自然数 a > b を確認・入替 */
if(a<b){
tmp = a;
a = b;
b = tmp;
}
/* ユークリッドの互除法 */
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
int Factorial(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
long long int Svec(vector<long long int> v){
long long int n=0;
for(long long int i=0;i<v.size();i++) n+=v[i];
return n;
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
int n,m;
bool flag=false;
cin>>n>>m;
vector<pair<int,int>> v;
set<int> st1,st2;
rep(i,m){
int a,b;
cin>>a>>b;
if(a==1 && b==n){
cout<<"POSSIBLE"<<endl;
return 0;
}
v.emplace_back(a,b);
}
rep(i,m){
if(v[i].first==1){
st1.insert(v[i].second);
}
}
rep(i,m){
if(v[i].second==n){
st2.insert(v[i].first);
}
}
if((st1 & st2).size()>=1) flag=true;
if(flag){
cout<<"POSSIBLE"<<endl;
}else{
cout<<"IMPOSSIBLE"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:83:11: error: no match for 'operator&' (operand types are 'std::set<int>' and 'std::set<int>')
83 | if((st1 & st2).size()>=1) flag=true;
| ~~~ ^ ~~~
| | |
| | set<[...]>
| set<[...]>
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:2:
/usr/include/c++/14/bitset:1557:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const bitset<_Nb>&, const bitset<_Nb>&)'
1557 | operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bitset:1557:5: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::bitset<_Nb>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
In file included from /usr/include/c++/14/valarray:605,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
411 | _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:411:5: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
/usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const valarray<_Tp>&)'
1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::valarray<_Tp>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
/usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::valarray<_Tp>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
/usr/include/c++/14/valarray:1202:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__bitwise_and, _Tp>::result_type> std::operator&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1202 | _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1202:1: note: template argument deduction/substitution failed:
a.cc:83:13: note: 'std::set<int>' is not derived from 'const std::valarray<_Tp>'
83 | if((st1 & st2).size()>=1) flag=true;
| ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)'
141 | operator&(byte __l, byte __r) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:141:18: note: no known conversion for argument 1 from 'std::set<int>' to 'std::byte'
141 | operator&(byte __l, byte __r) noexcept
| ~~~~~^~~
In file included from /usr/include/c++/14/streambuf:43,
from /usr/include/c++/14/bits/streambuf_iterator.h:35,
from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)'
84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
| ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:84:27: note: no known conversion for argument 1 from 'std::set<int>' to 'std::_Ios_Fmtflags'
84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)'
134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
| ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:134:27: note: no known conversion for argument 1 from 'std::set<int>' to 'std::_Ios_Openmode'
134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ios_base.h:181:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)'
181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
| ^~~~~~~~
/usr/include/c++/14/bits/ios_base.h:181:26: note: no known conversion for argument 1 from 'std::set<int>' to 'std::_Ios_Iostate'
181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
| ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/bits/shared_ptr_atomic.h:33,
from /usr/include/c++/14/memory:81,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56:
/usr/include/c++/14/bits/atomic_base.h:109:3: note: candidate: 'constexpr std::memory_order std::operator&(memory_order, __memory_order_modifier)'
109 | operator&(memory_order __m, __memory_order_modifier __mod) noexcept
| ^~~~~~~~
/usr/include/c++/14/bits/atomic_base.h:109:26: note: no known conversion for argument 1 from 'std::set<int>' to 'std::memory_order'
109 | operator&(memory_order __m, __memory_order_modifier __mod) noexcept
| ~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176:
/usr/include/c++/14/future:156:20: note: candidate: 'constexpr std::launch std::operator&(launch, launch)'
156 | constexpr launch operator&(launch __x, launch __y) noexcept
| ^~~~~~~~
/usr/include/c++/14/future:156:37: note: no known conversion for argument 1 from 'std::set<int>' to 'std::launch'
156 | constexpr launch operator&(launch __x, launch __y) noexcept
| ~~~~~~~^~~
In file included |
s709656005 | p03645 | Java | public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int m = Integer.parseInt(sc.next());
HashSet<Integer> aSet = new HashSet<>();
HashSet<Integer> bSet = new HashSet<>();
for (int i=0; i<m; i++){
int a = Integer.parseInt(sc.next());
int b = Integer.parseInt(sc.next());
if ( a == 1){
bSet.add(b);
}
if ( b == n){
aSet.add(a);
}
}
aSet.retainAll(bSet);
if (aSet.size() == 0){
System.out.println("IMPOSSIBLE");
}else {
System.out.println("POSSIBLE");
}
}
} | Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:8: error: cannot find symbol
HashSet<Integer> aSet = new HashSet<>();
^
symbol: class HashSet
location: class Main
Main.java:8: error: cannot find symbol
HashSet<Integer> aSet = new HashSet<>();
^
symbol: class HashSet
location: class Main
Main.java:9: error: cannot find symbol
HashSet<Integer> bSet = new HashSet<>();
^
symbol: class HashSet
location: class Main
Main.java:9: error: cannot find symbol
HashSet<Integer> bSet = new HashSet<>();
^
symbol: class HashSet
location: class Main
6 errors
|
s330514424 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int gcd(int a,int b)
{
int r, tmp;
/* 自然数 a > b を確認・入替 */
if(a<b){
tmp = a;
a = b;
b = tmp;
}
/* ユークリッドの互除法 */
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
int fac(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
bool flag=false;
int n,m;
cin>>n>>m;
vector<int> a(m),b(m),v
rep(i,m) cin>>a[i]>>b[i];
rep(i,m){
if(a[i]==1 && b[i]==n){
cout<<"POSSIBLE"<<endl;
return 0;
}
if(a[i]==1){
v.push_back(b[i]);
}
if(b[i]==n){
v.push_back(a[i]);
}
}
sort(v.begin(),v.end());
if(v.size()<=1){
cout<<"IMPOSSIBLE"<<endl;
return 0;
}
for(int i=0;i<v.size();i++){
if(v[i]==v[i+1]){
cout<<"POSSIBLE"<<endl;
return 0;
}
}
cout<<"IMPOSSIBLE"<<endl;
}
/////////////////////////// | a.cc: In function 'int main()':
a.cc:4:19: error: expected initializer before 'for'
4 | #define rep(i, n) for(int i = 0; i < (n); i++)
| ^~~
a.cc:74:3: note: in expansion of macro 'rep'
74 | rep(i,m) cin>>a[i]>>b[i];
| ^~~
a.cc:74:7: error: 'i' was not declared in this scope
74 | rep(i,m) cin>>a[i]>>b[i];
| ^
a.cc:4:34: note: in definition of macro 'rep'
4 | #define rep(i, n) for(int i = 0; i < (n); i++)
| ^
a.cc:81:7: error: 'v' was not declared in this scope
81 | v.push_back(b[i]);
| ^
a.cc:84:7: error: 'v' was not declared in this scope
84 | v.push_back(a[i]);
| ^
a.cc:87:8: error: 'v' was not declared in this scope
87 | sort(v.begin(),v.end());
| ^
|
s966328084 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
int int_len(int n) {
int s=0;
while(n!=0) s++, n/=10;
return s;
}
int int_sum(int n) {
int m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
return m;
}
int gcd(int a,int b)
{
int r, tmp;
/* 自然数 a > b を確認・入替 */
if(a<b){
tmp = a;
a = b;
b = tmp;
}
/* ユークリッドの互除法 */
r = a % b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
return b;
}
int fac(int n){
int m=1;
while(n>=1) m*=n,n--;
return m;
}
int vec_sum(vector<int> v){
int n=0;
for(int i=0;i<v.size();i++) n+=v[i];
return n;
}
///////////////////////////
int main() {
int n,m;
cin>>n>>m;
vector<int> a(m),b(m),v,w;
rep(i,m) cin>>a[i]>>b[i];
rep(i,m){
if(a[i]==1){
v.push_back(b[i]);
}
if(b[i]==n){
w.push_back(a[i]);
}
}
sort(v.begin(),v.end());
sort(w.begin(),w.end());
for(auto p:v){
for(auto q:w){
if(p==q){
flag=true;
break;
}
}
}
if(flag){
cout<<"POSSIBLE"<<endl;
}else{
cout<<"IMPOSSIBLE"<<endl;
}
}
/////////////////////////// | a.cc: In function 'int main()':
a.cc:87:9: error: 'flag' was not declared in this scope
87 | flag=true;
| ^~~~
a.cc:93:6: error: 'flag' was not declared in this scope
93 | if(flag){
| ^~~~
|
s698243027 | p03645 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
if('0' <= c && c <= '9') return (c-'0');
return -1;
}
using namespace std;
using pii = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8
#define N 200000
bool sx[N+1], xe[N+1];
int n, m, a, b;
int main() {
cin >> n >> m;
REP(i, m) {
cin >> a >> b;
if (a == 1) {
sx[b] = true;
} else if (b == n) {
xe[a] = true;
}
}
string ans = "IMPOSSIBLE";
REP(i, n) {
if (sx[i] && xe[i]) {
ans = "POSSIBLE";
break;
}
}
cout << ans << endl;
return 0;
} | a.cc:35:13: error: macro "REP" requires 3 arguments, but only 2 given
35 | REP(i, m) {
| ^
a.cc:14:9: note: macro "REP" defined here
14 | #define REP(i,a,b) for(int i=int(a);i<int(b);++i)
| ^~~
a.cc:44:13: error: macro "REP" requires 3 arguments, but only 2 given
44 | REP(i, n) {
| ^
a.cc:14:9: note: macro "REP" defined here
14 | #define REP(i,a,b) for(int i=int(a);i<int(b);++i)
| ^~~
a.cc: In function 'int main()':
a.cc:35:5: error: 'REP' was not declared in this scope
35 | REP(i, m) {
| ^~~
a.cc:44:8: error: expected ';' before '{' token
44 | REP(i, n) {
| ^ ~
| ;
|
s086738969 | p03645 | C++ | #include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int N, M;
const int MAXN = 200005;
vi to[MAXN];
int main () {
cin >> N >> M;
REP(i,M) {
int a, b;
cin >> a >> b;
a--, b--;
to[a].push_back(b);
}
for (auto c : to[0]) {
for (auto d : to[c]) {
if (d == N-1) {
cout << "POSSIBLE" << endl;
return 0;
}
}
}
cout << "IMPOSSIBLE" <<< endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:62:26: error: expected primary-expression before '<' token
62 | cout << "IMPOSSIBLE" <<< endl;
| ^
|
s167146708 | p03645 | C++ | #include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
int n,m,a[200005]={},b[200005]={};
cin >> n >> m;
for(int i=0; i<m; i++) {
int c,d;
cin >> c >> d;
if(c==1) {
b[d]++;
}
if(d==n) {
b[a]++;
}
}
for(int i=1; i<=n; i++) {
if(b[i]==2) {
cout << "POSSIBLE" << endl;
return 0;
}
}
cout << "IMPOSSIBLE" << endl;
}
| a.cc: In function 'int main()':
a.cc:17:8: error: invalid types 'int [200005][int [200005]]' for array subscript
17 | b[a]++;
| ^
|
s861766546 | p03645 | C++ | #include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
int n,m,a[200005]={},b[200005]={};
cin >> n >> m;
for(int i=0; i<m; i++) {
int c,d;
cin >> c >> d;
if(a==1) {
b[d]++;
}
if(b==n) {
b[a]++;
}
}
for(int i=1; i<=n; i++) {
if(b[i]==2) {
cout << "POSSIBLE" << endl;
return 0;
}
}
cout << "IMPOSSIBLE" << endl;
} | a.cc: In function 'int main()':
a.cc:13:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
13 | if(a==1) {
| ~^~~
a.cc:16:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
16 | if(b==n) {
| ~^~~
a.cc:17:8: error: invalid types 'int [200005][int [200005]]' for array subscript
17 | b[a]++;
| ^
|
s975221007 | p03645 | C++ | #include<iostream>
#include<unordered_map>
using namespace std;
int main(){
int n, m;
unordered_map <int, int> m;
cin >> n >> m;
for(int i=0; i<m; i++){
int a, b;
cin >> a >> b;
if(a==1){
m[b] |= 1;
if(m[b]==3) {
cout << "POSSIBLE";
return 0;
}
} else if (b == 1) {
m[a] |= 1;
if(m[a]==3) {
cout << "POSSIBLE";
return 0;
}
} else if (a == n) {
m[b] |= 2;
if(m[b]==3) {
cout << "POSSIBLE";
return 0;
}
} else if (b == n) {
m[a] |= 2;
if(m[a]==3) {
cout << "POSSIBLE";
return 0;
}
}
}
cout << "IMPOSSIBLE";
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:34: error: conflicting declaration 'std::unordered_map<int, int> m'
7 | unordered_map <int, int> m;
| ^
a.cc:6:16: note: previous declaration as 'int m'
6 | int n, m;
| ^
a.cc:13:26: error: invalid types 'int[int]' for array subscript
13 | m[b] |= 1;
| ^
a.cc:14:29: error: invalid types 'int[int]' for array subscript
14 | if(m[b]==3) {
| ^
a.cc:19:26: error: invalid types 'int[int]' for array subscript
19 | m[a] |= 1;
| ^
a.cc:20:29: error: invalid types 'int[int]' for array subscript
20 | if(m[a]==3) {
| ^
a.cc:25:26: error: invalid types 'int[int]' for array subscript
25 | m[b] |= 2;
| ^
a.cc:26:29: error: invalid types 'int[int]' for array subscript
26 | if(m[b]==3) {
| ^
a.cc:31:26: error: invalid types 'int[int]' for array subscript
31 | m[a] |= 2;
| ^
a.cc:32:29: error: invalid types 'int[int]' for array subscript
32 | if(m[a]==3) {
| ^
|
s970914878 | p03645 | C++ | #include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
const int nmax = 200002;
bool graph[nmax][nmax];
int n, m;
bool frag = false;
void dfs(int v, int depth) {
if (depth == 2 && v == n-1) frag = true;
if (depth > 2) return;
rep(i, n) {
if (!graph[v][i]) continue;
dfs(i, depth+1);
}
}
int main() {
cin >> n >> m;
rep(i, m) {
int x, y;
cin >> x >> y;
graph[x-1][y-1] = graph[y-1][x-1] = true;
}
dfs(0, 0);
if (frag) printf("POSSIBLE\n");
else printf("IMPOSSIBLE\n");
}
| /tmp/ccyh5qx1.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyh5qx1.o
a.cc:(.text+0x24): relocation truncated to fit: R_X86_64_PC32 against symbol `frag' defined in .bss section in /tmp/ccyh5qx1.o
a.cc:(.text+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyh5qx1.o
/tmp/ccyh5qx1.o: in function `main':
a.cc:(.text+0x95): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyh5qx1.o
a.cc:(.text+0xb1): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccyh5qx1.o
a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccyh5qx1.o
a.cc:(.text+0x186): relocation truncated to fit: R_X86_64_PC32 against symbol `frag' defined in .bss section in /tmp/ccyh5qx1.o
collect2: error: ld returned 1 exit status
|
s964702760 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define FINAL_OUT(x) {cout << (x) << endl;}
int main(void) {
int a, b, N, M;
bool s[200010];
bool t[200010];
cin >> N >> M;
for (int i = 0; i < M; i++) {
cin >> a >> b;
if (a == 1) s[b] = true;
if (b == N) t[a] = true;
}
for (int i = 2; i < N; i++) {
if (s[i] = true && t[i] = true) {
FINAL_OUT("POSSIBLE");
}
FINAL_OUT("POSSIBLE");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:21:33: error: lvalue required as left operand of assignment
21 | if (s[i] = true && t[i] = true) {
| ~~~~~^~~~~~~
|
s229414864 | p03645 | C++ |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
int main() {
int a,b, N, M;
bool s[200010];
bool t[200010];
cin >> N >> M;
for(int i = 0; i < M; i++){
cin >> a >> b;
if(a==1) s[b] = true;
if(b==N) t[a] = true;
}
for(int i = 2; i < N; i++)
if(s[i]&t[i])
FINAL_OUT("POSSIBLE");
FINAL_OUT("IMPOSSIBLE");
} | a.cc: In function 'int main()':
a.cc:22:7: error: 'FINAL_OUT' was not declared in this scope
22 | FINAL_OUT("POSSIBLE");
| ^~~~~~~~~
a.cc:23:3: error: 'FINAL_OUT' was not declared in this scope
23 | FINAL_OUT("IMPOSSIBLE");
| ^~~~~~~~~
|
s802287788 | p03645 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<int> ab, ba;
for(int i = 0; i < M; i++){
int a, b;
cin >> a >> b;
if(a == 1) ab.push_back(b);
if(b == 1) ab.push_back(a);
if(a == N) ba.push_back(b);
if(b == N) ba.push_back(a);
}
sort(ab.begin(), ab.end());
sort(ab.begin(), ab.end());
bool flag = false;
int i ,j = 0;
while(i < ab.size() && j < ba.size()){
if(ab[i] == ba[j]){
flag = true;
break
}else if(ab[i] > ba[j]){
j++;
}else if(ab[i] < ba[j]){
i++;
}
}
if(flag) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
}
| a.cc: In function 'int main()':
a.cc:30:12: error: expected ';' before '}' token
30 | break
| ^
| ;
31 | }else if(ab[i] > ba[j]){
| ~
|
s725190923 | p03645 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
int N, M;
cin >> N >> M;
vector<int> ab, ba;
for(int i = 0; i < M; i++){
int a, b;
cin >> a >> b;
if(a == 1) ab.push_back(b);
if(b == 1) ab.push_back(a);
if(a == N) ba.push_back(b);
if(b == N) ba.push_back(a);
}
sort(ab.begin(), ab.end());
sort(ab.begin(), ab.end());
bool flag = false;
int i ,j = 0;
while(i < ab.size() && j < ba.size()){
if(ab[i] == ba[j]){
flag = true;
break
}else if(ab[i] > ba[j]){
j++;
}else if(ab[i] < ba[j]){
i++;
}
}
if(flag) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
} | a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >> N >> M;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
9 | vector<int> ab, ba;
| ^~~~~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:9:10: error: expected primary-expression before 'int'
9 | vector<int> ab, ba;
| ^~~
a.cc:14:16: error: 'ab' was not declared in this scope; did you mean 'b'?
14 | if(a == 1) ab.push_back(b);
| ^~
| b
a.cc:15:16: error: 'ab' was not declared in this scope; did you mean 'b'?
15 | if(b == 1) ab.push_back(a);
| ^~
| b
a.cc:16:16: error: 'ba' was not declared in this scope; did you mean 'b'?
16 | if(a == N) ba.push_back(b);
| ^~
| b
a.cc:17:16: error: 'ba' was not declared in this scope; did you mean 'b'?
17 | if(b == N) ba.push_back(a);
| ^~
| b
a.cc:20:8: error: 'ab' was not declared in this scope; did you mean 'abs'?
20 | sort(ab.begin(), ab.end());
| ^~
| abs
a.cc:20:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
20 | sort(ab.begin(), ab.end());
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
a.cc:25:30: error: 'ba' was not declared in this scope
25 | while(i < ab.size() && j < ba.size()){
| ^~
a.cc:28:12: error: expected ';' before '}' token
28 | break
| ^
| ;
29 | }else if(ab[i] > ba[j]){
| ~
a.cc:35:12: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
35 | if(flag) cout << "POSSIBLE";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:36:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
36 | else cout << "IMPOSSIBLE";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s271200165 | p03645 | C++ | #include <iostream>
#include <vector>
#include <unorderd_map>
#include <map>
using namespace std;
int main(){
int N ,M;
cin >> N >> M;
unorderd_map<pair<int, int>, int> mp;
for(int i = 0; i < M; i++){
int a ,b;
cin >> a >> b;
pair<int, int> m = make_pair(a, b);
pair<int, int> ivm = make_pair(b, a);
mp[m]++;
mp[ivm]++;
}
bool ans = false;
if(mp[make_pair(1,N)]) ans = true;
for(int i = 1; i <= N; i++){
if(mp[make_pair(1,i)] && mp[make_pair(i,N)]) ans = true;
}
if(ans) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
}
| a.cc:3:10: fatal error: unorderd_map: No such file or directory
3 | #include <unorderd_map>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s727144046 | p03645 | C++ | #include <iostream>
#include <vector>
#include <unorderd_map>
#include <map>
using namespace std;
int main(){
int N ,M;
cin >> N >> M;
unorderd_map<pair<int, int>, int> mp;
for(int i = 0; i < M; i++){
int a ,b;
cin >> a >> b;
pair<int, int> m = make_pair(a, b);
pair<int, int> ivm = make_pair(b, a);
mp[m]++;
mp[ivm]++;
}
bool ans = false;
if(mp[make_pair(1,N)]) ans = true;
for(int i = 1; i <= N; i++){
if(mp[make_pair(1,i)] && mp[make_pair(i,N)]) ans = true;
}
if(ans) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
} | a.cc:3:10: fatal error: unorderd_map: No such file or directory
3 | #include <unorderd_map>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s607451718 | p03645 | C++ | #include <iostream>
#include <vector>
#include <unorderd_map>
using namespace std;
int N, M;
int main(){
cin >> N >> M;
unorderd_map<int, int> mp;
for(int i = 0; i < M; i++){
int a, b;
cin >> a >> b;
if(a > b){
int t = a;
a = b;
b = t;
}
mp[a] = b;
}
bool ans = false;
for(int i = 1; i <= N; i++){
if(mp[1] == i && mp[i] == N) ans = true;
}
if(ans) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
} | a.cc:3:10: fatal error: unorderd_map: No such file or directory
3 | #include <unorderd_map>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s364937619 | p03645 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
bool G[N][N] = {false};
int a[M] b[M];
for(int i = 0; i < M; i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
G[a[i]][b[i]] = G[b[i]][a[i]] = true;
}
bool ans = false;
for(int i = 0; i < N; i++){
if(G[i][0] && G[i][N-1]){
ans = true;
break;
}
}
if(ans) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
} | a.cc: In function 'int main()':
a.cc:12:12: error: expected initializer before 'b'
12 | int a[M] b[M];
| ^
a.cc:14:12: error: 'a' was not declared in this scope
14 | cin >> a[i] >> b[i];
| ^
a.cc:14:20: error: 'b' was not declared in this scope
14 | cin >> a[i] >> b[i];
| ^
|
s856053078 | p03645 | C++ | #include <iostream>
#include <vector>
using namespace std;
void visit(int v, int hop, vector<bool> &visited, vector<vector<bool>> &G){
if(hop == 2) return;
visited[v] = true;
for(int v2 = 0; v2 < N; v2++){
if(visited[v2])continue;
if(G[v][v2] == false) continue;
visit(v2, hop+1, visited, G);
}
}
int main(){
int N, M;
cin >> N >> M;
vector<bool> visited(N,false);
vector<vector<bool>> G(N, vector<bool>(N, false));
//bool G[N][N];と等価
vector<int> a(M,0);
vector<int> b(M,0);
for(int i = 0; i < M; i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
G[a[i]][b[i]] = G[b[i]][a[i]] = true;
}
visit(1,0, visited, G);
if(visited[N-1]) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
}
| a.cc: In function 'void visit(int, int, std::vector<bool>&, std::vector<std::vector<bool> >&)':
a.cc:9:24: error: 'N' was not declared in this scope
9 | for(int v2 = 0; v2 < N; v2++){
| ^
|
s355168222 | p03645 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<bool> visited(N,false);
vector<vector<bool>> G(N, vector<bool>(N, false));
//bool G[N][N];と等価
vector<int> a(M,0);
vector<int> b(M,0);
void visit(int v, int hop, vector<bool> &visited, vector<vector<bool>> &G){
if(hop == 2) return;
visited[v] = true;
for(int v2 = 0; v2 < N; v2++){
if(visited[v2])continue;
if(G[v][v2] == false) continue;
visit(v2, hop+1, visited, G);
}
}
for(int i = 0; i < M; i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
G[a[i]][b[i]] = G[b[i]][a[i]] = true;
}
visit(1,0, visited, G);
if(visited[N-1]) cout << "POSSIBLE";
else cout << "IMPOSSIBLE";
}
| a.cc: In function 'int main()':
a.cc:16:77: error: a function-definition is not allowed here before '{' token
16 | void visit(int v, int hop, vector<bool> &visited, vector<vector<bool>> &G){
| ^
a.cc:33:3: error: 'visit' was not declared in this scope
33 | visit(1,0, visited, G);
| ^~~~~
a.cc:3:1: note: 'std::visit' is defined in header '<variant>'; this is probably fixable by adding '#include <variant>'
2 | #include <vector>
+++ |+#include <variant>
3 |
|
s544878028 | p03645 | C++ | #include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;
int main(){
ll n,m;
cin>>n>>m;
ll a[m],b[m];
rep(i,0,m)cin>>a[i]>>b[i];
vector <ll> s,e;
bool p=false;
rep(i,0,m){
if(a[i]==1)s.push_back(i);
else if(b[i]==n)e.push_back(i);
}
rep(i,0,s.size()){
rep(j,0,e.size()) if(b[s[i]]==a[e[j]]){p=true;break}
}
if(p)cout<<"POSSIBLE";
else cout<<"IMPOSSIBLE";
} | a.cc: In function 'int main()':
a.cc:20:60: error: expected ';' before '}' token
20 | rep(j,0,e.size()) if(b[s[i]]==a[e[j]]){p=true;break}
| ^
| ;
|
s900387372 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,M;
cin >> N>>M;
vector<int> a(M);
vector<int> b(M);
for(int i=0;i<M;i++){
cin >> a[i]>> b[i];
}
/*
bool from1=false, toN=false;
for(int i=2;i<N;i++){
from1=false;
toN=false;
for(int j=0;j<M;j++){
if(a[j]==1 && b[j]==i){
from1=true;
break;
}
}
for(int j=0;j<M;j++){
if(a[j]==i && b[j]==N){
toN=true;
break;
}
}
if(from1 && toN) break;
}
*/
for(int i=0;i<M;i++){
if(a[i]==1){
int c=b[i];
for(int j=0;j<M;j++){
if(a[j]==c && b[j] ==N){
cout << "POSSIBLE" << endl;
return 0;
}
}
}
}
if(from1 && toN) cout << "POSSIBLE" << endl ;
else cout << "IMPOSSIBLE" << endl;
}
| a.cc: In function 'int main()':
a.cc:46:6: error: 'from1' was not declared in this scope; did you mean 'fromfp'?
46 | if(from1 && toN) cout << "POSSIBLE" << endl ;
| ^~~~~
| fromfp
a.cc:46:15: error: 'toN' was not declared in this scope
46 | if(from1 && toN) cout << "POSSIBLE" << endl ;
| ^~~
|
s443610685 | p03645 | C++ | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
using namespace std;
int N;
int M;
int a[200001];
int b[200001];
bool graph[200001][200001];
bool visited[200001];
void dfs(int v, int num){
visited[v] = true;
if(num == 2) return;
for(int i = 0; i < N; i++){
if(visited[i] == false && graph[v][i] == true){
dfs(i,num+1);
}
}
return;
}
int main(void){
cin >> N >> M;
for(int i=0;i<M;i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;;
}
dfs(0,0);
if(visited[N-1] == true) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
| /tmp/cc0QoXs3.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc0QoXs3.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc0QoXs3.o
/tmp/cc0QoXs3.o: in function `main':
a.cc:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc0QoXs3.o
collect2: error: ld returned 1 exit status
|
s867335035 | p03645 | C++ | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
using namespace std;
int N;
int M;
int a[200001];
int b[200001];
bool graph[200001][200001] = {false};
bool visited[200001] = {false};
void dfs(int v, int num){
visited[v] = true;
if(num == 2) return;
for(int i = 0; i < N; i++){
if(visited[i] == false && graph[v][i] == true){
dfs(i,num+1);
}
}
return;
}
int main(void){
cin >> N >> M;
for(int i=0;i<M;i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;;
}
dfs(0,0);
if(visited[N-1] == true) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
| /tmp/cc3M39AD.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc3M39AD.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc3M39AD.o
/tmp/cc3M39AD.o: in function `main':
a.cc:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc3M39AD.o
collect2: error: ld returned 1 exit status
|
s003695547 | p03645 | C++ | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
using namespace std;
int N;
int M;
int a[200001];
int b[200001];
bool graph[200001][200001] = {false};
bool visited[200001] = {false};
void dfs(int v, int num){
visited[v] = true;
if(num == 2) return;
for(int i = 0; i < N; i++){
if(visited[i] == false && graph[v][i] == true){
dfs(i,num+1);
}
}
}
int main(void){
cin >> N >> M;
for(int i=0;i<M;i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;;
}
dfs(0,0);
if(visited[N-1] == true) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
| /tmp/cc1SrKaE.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc1SrKaE.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc1SrKaE.o
/tmp/cc1SrKaE.o: in function `main':
a.cc:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc1SrKaE.o
collect2: error: ld returned 1 exit status
|
s089723331 | p03645 | C++ | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
using namespace std;
int N;
int M;
int a[200001];
int b[200001];
bool graph[200001][200001] = {false};
bool visited[200001] = {false};
void dfs(int v, int num){
visited[v] = true;
if(num == 2) return;
for(int i = 0; i < N+1; i++){
if(visited[i] == false && graph[v][i] == true){
dfs(i,num+1);
}
}
}
int main(void){
cin >> N >> M;
N--;
for(int i=0;i<M;i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;;
}
dfs(0,0);
if(visited[N] == true) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
| /tmp/ccTsd6WV.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccTsd6WV.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccTsd6WV.o
/tmp/ccTsd6WV.o: in function `main':
a.cc:(.text+0x276): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccTsd6WV.o
collect2: error: ld returned 1 exit status
|
s539602461 | p03645 | C++ | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
using namespace std;
int N;
int M;
int a[200001];
int b[200001];
bool graph[200001][200001] = {false};
bool visited[200001] = {false};
bool flag = false;
void dfs(int v, int num){
visited[v] = true;
if(num == 2) return;
for(int i = 0; i < N+1; i++){
if(visited[i] == false && graph[v][i] == true){
dfs(i,num+1);
}
}
}
int main(){
cin >> N >> M;
N--;
for(int i=0;i<M;i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;;
}
dfs(0,0);
if(visited[N] == true) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
| /tmp/ccODfbwX.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccODfbwX.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccODfbwX.o
/tmp/ccODfbwX.o: in function `main':
a.cc:(.text+0x276): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccODfbwX.o
collect2: error: ld returned 1 exit status
|
s410082023 | p03645 | C++ | #include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
using namespace std;
int N;
int M;
int a[200001];
int b[200001];
bool graph[200001][200001] = {false};
bool visited[200001] = {false};
bool flag = false;
void dfs(int v, int num){
visited[v] = true;
if(num == 2) return;
for(int i = 0; i < N+1; i++){
if(visited[i] == false && graph[v][i] == true){
dfs(i,num+1);
}
}
}
int main(){
cin >> N >> M;
N--;
for(int i=0;i<M;i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;;
}
dfs(0,0);
if(visited[N] == true) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
}
| /tmp/ccbe6TPZ.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccbe6TPZ.o
a.cc:(.text+0x35): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccbe6TPZ.o
/tmp/ccbe6TPZ.o: in function `main':
a.cc:(.text+0x276): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccbe6TPZ.o
collect2: error: ld returned 1 exit status
|
s211512885 | p03645 | C++ | #include <ioatream>
#include <vector>
using namespace std;
int main(void){
int N,M;
cin >> N >> M;
vector<vector<bool>>reachable(200001,vector<bool>(200001,false));
for(int i=0;i<M;i++){
int a,b;
cin >> a >> b;
reachable[a][b] = reachable[b][a] = true;
}
bool ans = false;
for(int i=2;i<N;i++){
if(reachable[1][i] == true && reachable[i][N] == true)
ans = true;
}
if(ans)
cout << "POSSIBLE" << endl;
else
cout << "IMPOSSIBLE" << endl;
return 0;
}
| a.cc:1:10: fatal error: ioatream: No such file or directory
1 | #include <ioatream>
| ^~~~~~~~~~
compilation terminated.
|
s552416396 | p03645 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
return 0;
}
char upper(char c){
return c-0x20;
}
char lower(char c){
return c+0x20;
}
ll gcd(ll x, ll y) {
if (y == 0) return x;
return gcd(y, x%y);
}
ll lcm(ll x, ll y){
ll g = gcd(x,y);
return x/g*y;
}
int main(){
int n,m; cin >> n >> m;
vector<pair<int, int> > p(m);
vector<int> v;
rep(i,m){
int a, b;
cin >> a >> b;
if (a==1){
v.push_back(b);
}
p[i] = make_pair(b,a);
}
sort(rall(p));
sort(all(v));
vector<int> g(200007), s(200007);
rep(i,n){
if (p[i].first != n) break;
g[p[i].second]++;
}
rep(i,v.size()){
s[v[i]]++;
}
rep(i,200007){
if (g[i]>0 && s[i]>0){
cout << "POSSIBLE" << endl;
return 0;
}
}
}
cout << "IMPOSSIBLE" << endl;
} | a.cc:71:9: error: 'cout' does not name a type
71 | cout << "IMPOSSIBLE" << endl;
| ^~~~
a.cc:72:1: error: expected declaration before '}' token
72 | }
| ^
|
s187371414 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
int a, b;
bool exist_route = false;
cin >> N >> M;
vector<bool> pass = (N+1, false);
for (int i=0; i<M; i++){
cin >> a >> b;
if( a == 1){
if(pass[b]){
exist_route = true;
}
pass[b] = true;
}
else if( b == N ){
if(pass[b]){
exist_route = true;
}
pass[a] = true;
}
}
if( exist_route){
cout << "POSSIBLE";
}
else{
cout << "IMPOSSIBLE";
}
} | a.cc: In function 'int main()':
a.cc:10:40: error: conversion from 'bool' to non-scalar type 'std::vector<bool>' requested
10 | vector<bool> pass = (N+1, false);
| ^
|
s584113441 | p03645 | C++ | #include <bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9
using namespace std;
/**
* calculate GCD(greatest common divisor)
* @param a
* @param b
* @return
*/
unsigned euclidean_gcd(unsigned a, unsigned b) {
if (a < b) return euclidean_gcd(b, a);
unsigned r;
while ((r = a % b)) {
a = b;
b = r;
}
return b;
}
/**
* change minimum
* @tparam T
* @param a
* @param b
* @return bool
*/
template<class T>
inline bool changeMinimum(T &a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
/**
* change maximum
* @tparam T
* @param a
* @param b
* @return bool
*/
template<class T>
inline bool changeMaximum(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
/**
* output answer
* @tparam T
* @param answer
* @return
*/
template<typename T>
T output(T answer) {
cout << answer << endl;
return 0;
}
/** ----from here ---------------------------------------------------------- */
int main() {
int N, M;
cin >> N >> M;
// pair<int, std::string> p;
// for (int i = 0; i < 3; ++i) {
// p = make_pair(1, "he");
// p = make_pair(2, "hel");
// p = make_pair(3, "hell");
// }
map<int, int> s;
for (int i = 0; i < M; ++i) {
int key, value;
cin >> key >> value;
s[key] = value;
}
vector<int> c;
c.push_back(1);
c.push_back(2);
for (int i = 0; i < 2; ++i) {
cout << c[i] << endl;
}
for (pair<int, int> p:s) {
int a = p.first;
int b = p.second;
if (a == 1) {
c.push_back(b);
}
}
bool ans = false;
for (pair<int, int> p:s) {
int a = p.first;
int b = p.second;
if (b == N) {
for (int j = 0; j < c.size(); ++j) {
int cc = c[i];
if (cc == a) {
ans = true;
}
}
}
}
string str;
if (ans) {
str = "POSSIBLE";
} else {
str = "IMPOSSIBLE";
}
cout << str << endl;
} | a.cc: In function 'int main()':
a.cc:116:28: error: 'i' was not declared in this scope
116 | int cc = c[i];
| ^
|
s425321349 | p03645 | C++ | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> int former(const vector<T> &v, T x){
return upper_bound(v.begin(),v.end(),x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x){
return lower_bound(v.begin(),v.end(),x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) { }
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0) return x;
else return par[x] = root(par[x]);
}
bool issame(ll x, ll y) {
return root(x) == root(y);
}
bool merge(ll x, ll y) {
x = root(x); y = root(y);
if (x == y) return false;
if (par[x] > par[y]) swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) {
return -par[root(x)];
}
};
template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n=G.size();
vector<T> d(n,INF);
vector<int> b(n,-1);
priority_queue<P,vector<P>,greater<P> > q;
d[s]=0;
q.emplace(d[s],s);
while(!q.empty()){
P p=q.top();q.pop();
int v=p.second;
if(d[v]<p.first) continue;
for(auto& e:G[v]){
int u=e.first;
T c=e.second;
if(d[u]>d[v]+c){
d[u]=d[v]+c;
b[u]=v;
q.emplace(d[u],u);
}
}
}
return d;
}
vector<vector<int> > bfs(vector<string> &s,int sy,int sx,char wall,int dir){
int h=s.size(),w=s.front().size();
vector<vector<int> > dp(h,vector<int>(w,-1));
using P = pair<int, int>;
queue<P> q;
dp[sy][sx]=0;
q.emplace(sy,sx);
int dy[]={1,-1,0,0,1,1,-1,-1};
int dx[]={0,0,1,-1,1,-1,1,-1};
auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};
while(!q.empty()){
int y,x;
tie(y,x)=q.front();q.pop();
for(int k=0;k<dir;k++){
int ny=y+dy[k],nx=x+dx[k];
if(!in(ny,nx)||s[ny][nx]==wall) continue;
if(~dp[ny][nx]) continue;
dp[ny][nx]=dp[y][x]+1;
q.emplace(ny,nx);
}
}
return dp;
}
std::vector<ll> divisor(ll n)//nの約数を列挙
{
std::vector<ll> ret;
for(ll i=1 ; i*i<=n ; ++i)
{
if(n%i == 0)
{
ret.push_back(i);
if(i!=1 && i*i!=n)
{
ret.push_back(n/i);
}
}
}
return ret;
}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int main(void){
int N,M;
cin >> N >> M;
vector<int> start;
vector<int> goal;
rep(i,M){
int a, b;
cin >> a >> b;
if(a == 1) start.pb(b);
if(b == N) goal.pb(a);
}
sort(all(start));
rep(i,goal.size()){
if(goal[i] == *lower_bound(all(start), goal[i]){
cout << "POSSIBLE" << endl;
return 0;
}
}
cout << "IMPOSSIBLE" << endl;
}
| a.cc: In function 'int main()':
a.cc:180:53: error: expected ')' before '{' token
180 | if(goal[i] == *lower_bound(all(start), goal[i]){
| ~ ^
| )
a.cc:184:3: error: expected primary-expression before '}' token
184 | }
| ^
|
s697082694 | p03645 | C | #include <stdio.h>
int main(void){
int N,M,i,j,a[200000],b[200000],temp[200000],swi=0,cnt=0;
scanf("%d %d",&N,&M);
for(i=0;i<M;i++)
scanf("%d %d",&a[i],&b[i]);
for(i=0;i<N;i++) /* 島1から船1本で行ける島の探索(条件を満たす島の数もカウントする) */
if(a[i]==1){
for(j=0;j<N;j++)
temp[j]=b[i];
cnt++;
}
for(j=0;j<=cnt&&swi==0;j++){ /* 島Nが島1から船2本で行ける(=島1から船1本で行ける島から船1本で行ける)か判定 */
for(i=0;i<N;i++){
if(temp[j]==a[i]&&b[i]==N)
swi=1;
}
}
if(swi==1)
printf("POSSIBLE");
else
printf("IMPOSSIBLE");
return(0);
}
| main.c: In function 'main':
main.c:8:21: error: stray '\343' in program
8 | for(i=0;i<N;i++)<U+3000><U+3000>/* <U+5CF6>1<U+304B><U+3089><U+8239>1<U+672C><U+3067><U+884C><U+3051><U+308B><U+5CF6><U+306E><U+63A2><U+7D22>(<U+6761><U+4EF6><U+3092><U+6E80><U+305F><U+3059><U+5CF6><U+306E><U+6570><U+3082><U+30AB><U+30A6><U+30F3><U+30C8><U+3059><U+308B>) */
| ^~~~~~~~
main.c:8:23: error: stray '\343' in program
8 | for(i=0;i<N;i++)<U+3000><U+3000>/* <U+5CF6>1<U+304B><U+3089><U+8239>1<U+672C><U+3067><U+884C><U+3051><U+308B><U+5CF6><U+306E><U+63A2><U+7D22>(<U+6761><U+4EF6><U+3092><U+6E80><U+305F><U+3059><U+5CF6><U+306E><U+6570><U+3082><U+30AB><U+30A6><U+30F3><U+30C8><U+3059><U+308B>) */
| ^~~~~~~~
main.c:14:5: error: stray '\343' in program
14 | <U+3000>
| ^~~~~~~~
|
s167666244 | p03645 | C++ | #include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
int main() {
int n, m;
scanf_s("%d %d", &n, &m);
int a, b;
vector<bool>v1(m,false);
vector<bool>vn(m,false);//あえて多くメモリを確保し、中継点の番号を一致させ、O(N)を実現
for (int i = 0; i < m; ++i) {
scanf_s("%d %d", &a, &b);
if (a == 1)v1[i]=true;
else if (b == n)vn[i]=true;
}
for (int i = 0; i < m; ++i) {
if (v1[i]==true && vn[i]==true) {
printf("POSSIBLE\n");
return 0;
}
}
printf("IMPOSSIBLE\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:8:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
8 | scanf_s("%d %d", &n, &m);
| ^~~~~~~
| scanf
|
s410888283 | p03645 | C++ | easy | a.cc:1:1: error: 'easy' does not name a type
1 | easy
| ^~~~
|
s796620375 | p03645 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
using namespace std;
int main(void){
int N , M;
cin >> N >> M;
vector<bool> a(200000);
vector<bool> b(200000);
for (int i = 0;i < 200000; i++){
a[i] = 0;
b[i] = 0;
}
if (N < 3 && N > 200000 && 1 > M && M > 200000){
return 0;
}
for (int i = 0;i < M; i++){
long long from,to;
cin >> from >> to;
if(from == 1){
a[to] = true;
}
if(to == N){
b[from] = true
}
}
for (int i = 0;i < N; i++){
if(a[i] && b[i]){
cout << "POSSIBLE" << endl;
return 0;
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:27: error: expected ';' before '}' token
26 | b[from] = true
| ^
| ;
27 | }
| ~
|
s137331346 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
const int SIZE=200005;
int A[SIZE],B[SIZE];
int C[SIZE];
int main(){
int n;
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>A[i]>>B[i];
}
for(int i=0;i<n;i++)
if(A[i]==1) C[B[i]]=1;
bool ans=false;
for(int i=0;i<n;i++){
if(B[i]==n&&C[A[i]]==1) ans==true;
if(ans) break;
}
if(!ans) cout<<"IM";
cout<<"POSSIBLE"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:17: error: 'm' was not declared in this scope
8 | cin>>n>>m;
| ^
|
s269243655 | p03645 | C++ | #include <iostream>
using namespace std;
int main(){
int n, m;
cin>>n>>m;
vector<bool>vis(n + 1, false);
bool ans = false;
for (int i = 0; i < m; i ++){
int a, b;
cin>>a>>b;
if (a == 1){
if(vis[b]){
ans = true;
}
vis[b] = true;
}else if(b == n){
if (vis[a]){
ans = true;
}
vis[a] = true;
}
}
if(!ans)cout << "IM";
cout << "POSSIBLE" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'vector' was not declared in this scope
6 | vector<bool>vis(n + 1, false);
| ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
1 | #include <iostream>
+++ |+#include <vector>
2 | using namespace std;
a.cc:6:16: error: expected primary-expression before 'bool'
6 | vector<bool>vis(n + 1, false);
| ^~~~
a.cc:12:28: error: 'vis' was not declared in this scope
12 | if(vis[b]){
| ^~~
a.cc:15:25: error: 'vis' was not declared in this scope
15 | vis[b] = true;
| ^~~
a.cc:17:29: error: 'vis' was not declared in this scope
17 | if (vis[a]){
| ^~~
a.cc:20:25: error: 'vis' was not declared in this scope
20 | vis[a] = true;
| ^~~
|
s651361992 | p03645 | C++ | #include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
int N, M;
cin >> N >> M;
vector<int> a(M), b(M);
for( int i = 0; i < M; ++i ) cin >> a[i] >> b[i];
vector<int> firstBoat, secondBoat;
bool ans = false;
for( auto f: firstBoat ){
for( auto s; secondBoat ){
if( f == s ){
ans = true;
break;
}
}
}
if( ans ) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:14: error: declaration of 'auto s' has no initializer
18 | for( auto s; secondBoat ){
| ^~~~
a.cc:18:22: error: could not convert 'secondBoat' from 'std::vector<int>' to 'bool'
18 | for( auto s; secondBoat ){
| ^~~~~~~~~~
| |
| std::vector<int>
a.cc:18:32: error: expected ';' before ')' token
18 | for( auto s; secondBoat ){
| ^~
| ;
|
s178514989 | p03645 | C++ | //file_name:ABC68_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
// int scan
/*
int x;
scanf("%d",&x);
int y;
scanf("%d",&y);
int z;
scanf("%d",&z);
// matrix scan
/*
ll a[n] = {};
rep(i,n){
scanf("%lld",&a[i]);
}
*/
// string scan
/*
string s;
cin >> s;
*/
int main() {
int n,m;
scanf("%d%d",&n,&m);
int c[m] = {};
int d[m] = {};
int countc = 0;
int countd = 0;
rep(i,m){
int a,b;
cin >> a >> b;
if(a==1){
c[countc] = b;
countc++;
}
if(b==n) {
d[countd] = a;
countd++;
}
}
sort(c,c+countc);
sort(d,d+countd);
int i = 0;
int j = 0;
while(true){
if(c[i]==0||d[j]==0)break;
if(c[i]==d[j]){
cout << "POSSIBLE" endl;
return 0;
}
if(c[i]<d[j]){
i++;
}else{
j++;
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:105:31: error: expected ';' before 'endl'
105 | cout << "POSSIBLE" endl;
| ^~~~~
| ;
|
s931388789 | p03645 | C++ | #include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>
#include<map>
using namespace std;
int main(){
int N,M,A,B,ok[200001]={};
cin>>N>>M;
for(int i=0;i<M;i++){
cin>>A>>B;
if(A==1){
ok[B]++;
}
if(B[i]==N){
ok[A]++;
}
}
for(int i=1;i<=N;i++){
if(ok[i]==2){
cout<<"POSSIBLE"<<endl;
return 0;
}
}
cout<<"IMPOSSIBLE"<<endl;
} | a.cc: In function 'int main()':
a.cc:21:21: error: invalid types 'int[int]' for array subscript
21 | if(B[i]==N){
| ^
|
s694551530 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
ll n, m; cin >> n >> m;
ll a[m], b[m];
pair<ll, ll> pp;
vector<ll> v_f, v_e;
bool flg = false;
for(ll i = 0; i < m; i++){
cin >> a[i] >> b[i];
if(a[i] == 1){
vf.push_back(b[i]);
}
if(b[i] == n){
ve.push_back(a[i]);
}
}
for(int i = 0; i < vf.size(); i++){
for(int j = 0; j < ve.size(); j++){
if(vf[i] == ve[j]) flg = true;
}
}
if(flg) cout << "POSSIBLE" << endl;
else cout << "IMPOSSIBLE" << endl;
} | a.cc: In function 'int main()':
a.cc:19:13: error: 'vf' was not declared in this scope; did you mean 'v_f'?
19 | vf.push_back(b[i]);
| ^~
| v_f
a.cc:22:13: error: 've' was not declared in this scope; did you mean 'v_e'?
22 | ve.push_back(a[i]);
| ^~
| v_e
a.cc:25:24: error: 'vf' was not declared in this scope; did you mean 'v_f'?
25 | for(int i = 0; i < vf.size(); i++){
| ^~
| v_f
a.cc:26:28: error: 've' was not declared in this scope; did you mean 'v_e'?
26 | for(int j = 0; j < ve.size(); j++){
| ^~
| v_e
|
s332092339 | p03645 | C++ | int main(){
int n,m,x,y;
bool a[200010],b[200010];
a[0]=false;
b[0]=false;
cin>>n>>m;
for(int i=0;i<m;i++){
cin>>x>>y;
if(x==1){
a[y]=1;
}
if(y==n){
b[x]=1;
}
}
for(int i=2;i<=n;i++){
if(a[i]==1&&b[i]==1){
cout<<"POSSIBLE"<<endl;
return 0;
}
}
cout<<"IMPOSSIBLE"<<endl;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
6 | cin>>n>>m;
| ^~~
a.cc:19:17: error: 'cout' was not declared in this scope
19 | cout<<"POSSIBLE"<<endl;
| ^~~~
a.cc:19:35: error: 'endl' was not declared in this scope
19 | cout<<"POSSIBLE"<<endl;
| ^~~~
a.cc:24:9: error: 'cout' was not declared in this scope
24 | cout<<"IMPOSSIBLE"<<endl;
| ^~~~
a.cc:24:29: error: 'endl' was not declared in this scope
24 | cout<<"IMPOSSIBLE"<<endl;
| ^~~~
|
s750073215 | p03645 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
int N, M;
cin >> N >> M;
vector<bool>S(N + 1, false), E(N + 1, false);
bool ans = false;
for (int i = 0; i < M; ++i) {
int a, b;
cin >> a >> b;
if (a == 1) {
S[b] = true;
}
if (b == N) {
E[a] = true;
}
}
for (int i = 0; i < N+1; ++i) {
if (S[i] && E[i]) {
ans = true;
}
}
if (!ans)cout << "IM";
cout << "POSSIBLE" << endl;
return 0; | a.cc: In function 'int main()':
a.cc:41:18: error: expected '}' at end of input
41 | return 0;
| ^
a.cc:19:12: note: to match this '{'
19 | int main() {
| ^
|
s338205741 | p03645 | C++ | #include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
int main(void) {
ll n, m, a, b;
cin >> n >> m;
vector<ll>island[3];
for (ll i = 0;i < m;i++) {
cin >> a >> b;
if (a == 1) {
island[a].push_back(b);
}
else {
if (b == n) {
island[2].push_back(a);
}
}
}
for (ll i = 2;i < n;i++) {
auto itr1 = find(island[1].begin(), island[1].end(), i);
if (itr1 != island[1].end()) {
auto itr2 = find(island[2].begin(), island[2].end(), i);
if (itr2 != island[2].end()) {
cout << "POSSIBLE" << endl;
return 0;
}
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:33: error: no matching function for call to 'find(std::vector<long long int>::iterator, std::vector<long long int>::iterator, ll&)'
23 | auto itr1 = find(island[1].begin(), island[1].end(), i);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:23:33: note: '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
23 | auto itr1 = find(island[1].begin(), island[1].end(), i);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:41: error: no matching function for call to 'find(std::vector<long long int>::iterator, std::vector<long long int>::iterator, ll&)'
25 | auto itr2 = find(island[2].begin(), island[2].end(), i);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:25:41: note: '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
25 | auto itr2 = find(island[2].begin(), island[2].end(), i);
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s378575354 | p03645 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,c=0;
cin>>n>>m;
set<int> se;
for(int i=0;i<m;i++){
int a,b;
cin>>a>>b;
if(a==1){
se.insert(b);
c++;
}
if(b==n){
se.insert(a);
c++;
}
}
cout<<(c==se.size()?"IMPOSSIBLE":POSSIBLE");
} | a.cc:19:44: warning: missing terminating " character
19 | cout<<(c==se.size()?"IMPOSSIBLE":POSSIBLE");
| ^
a.cc:19:44: error: missing terminating " character
19 | cout<<(c==se.size()?"IMPOSSIBLE":POSSIBLE");
| ^~~
a.cc: In function 'int main()':
a.cc:19:36: error: 'POSSIBLE' was not declared in this scope
19 | cout<<(c==se.size()?"IMPOSSIBLE":POSSIBLE");
| ^~~~~~~~
a.cc:19:44: error: expected ')' before '}' token
19 | cout<<(c==se.size()?"IMPOSSIBLE":POSSIBLE");
| ~ ^
| )
20 | }
| ~
|
s749398229 | p03645 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
if(m == 1){
cout << "IMPOSSIBLE" << endl;
return 0;
}
bool flag = false;
vector<int> b, ans;
for(int i = 0; i < m; i++){
int x, y;
cin >> x >> y;
if(x == 1){
b.push_back(y);
flag = true;
}
if(y == n){
ans.push_back(x);
flag = true;
}
}
sort(ans.begin(), ans.end());
sort(b.begin(), b.end());
decltype(ans)::iterator v1 = unique(ans.begin(), ans.end());
decltype(b)::iterator v2 = unique(b.begin(), b.end());
ans.erase(v1, ans.end());
b.erase(v2, b.end());
if(flag){
/*
for(int i = 0; i < b.size(); i++){
auto result = find(ans.begin(), ans.end(), b[i]);
if(result != ans.end()){
cout << "POSSIBLE" << endl;
return 0;
}
}*/
for(int i = 0; i < ans.size(); i++){
auto res = find(b.begin(), b.end(), ans[i]);
if(res != b.end()){
cout << "POSSIBLE" << endl;
return 0
}
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:49:25: error: expected ';' before '}' token
49 | return 0
| ^
| ;
50 | }
| ~
|
s727148734 | p03645 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
if(m == 1){
cout << "IMPOSSIBLE" << endl;
return 0;
}
bool flag = false;
vector<int> b, ans;
for(int i = 0; i < m; i++){
int x, y;
cin >> x >> y;
if(x == 1){
b.push_back(y);
flag = true;
}
if(y == n){
ans.push_back(x);
flag = true;
}
}
sort(ans.begin(), ans.end());
sort(b.begin(), b.end());
//cout << "ans:" << ans.size() << endl;
//cout << "b:" << b.size() << endl;
decltype(ans)::iterator v1 = unique(ans.begin(), ans.end());
decltype(b)::iterator v2 = unique(b.begin(), b.end());
ans.erase(v1, ans.end());
b.erase(v2, b.end());
//cout << "ans:" << ans.size() << endl;
//cout << "b:" << b.size() << endl;
auto err = find(ans.negin(), ans.end(), b[b.size() - 1]);
if(err != ans.end()){
cout << "POSSIBLE" << endl;
return 0;
}
if(flag){
for(int i = 0; i < b.size(); i++){
auto result = find(ans.begin(), ans.end(), b[i]);
if(result != ans.end()){
cout << "POSSIBLE" << endl;
return 0;
}
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:40:25: error: 'class std::vector<int>' has no member named 'negin'; did you mean 'begin'?
40 | auto err = find(ans.negin(), ans.end(), b[b.size() - 1]);
| ^~~~~
| begin
|
s282386819 | p03645 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
bool flag = false;
vector<int> a, b;
for(int i = 0; i < m; i++){
int x, y;
cin >> x >> y;
if(x == 1 || y == n){
a.push_back(x);
b.push_back(y);
flag = true;
}
}
if(flag){
for(int i = 0; i < a.size(); i++){
auto ans = find(b.begin(), b.end(), a[i]);
if(ans != b.end()){
cout << "POSSIBLE" << endl;
return 0
}
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:27:25: error: expected ';' before '}' token
27 | return 0
| ^
| ;
28 | }
| ~
|
s492370283 | p03645 | Java | import java.io.File;
import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
//File file = new File("input.txt");
//Scanner in = new Scanner(file);
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int[][] ab = new int[m][2];
boolean[] tf = new boolean[n+1];
for(int i = 0; i < n; i++) {
ab[i][0] = in.nextInt();
ab[i][1] = in.nextInt();
if(ab[i][0] == 1) tf[ab[i][1]] = true;
}
for(int i = 0; i < n; i++) {
if(tf[ab[i][0]] && ab[i][1] == N){
System.out.println("POSSIBLE");
return;
}
}
System.out.println("IMPOSSIBLE");
}
}
| Main.java:26: error: cannot find symbol
if(tf[ab[i][0]] && ab[i][1] == N){
^
symbol: variable N
location: class Main
1 error
|
s696523122 | p03645 | Java | import java.io.File;
import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
//File file = new File("input.txt");
//Scanner in = new Scanner(file);
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int[][] ab = new int[m][2];
boolean[] tf new boolean[n+1];
for(int i = 0; i < n; i++) {
ab[i][0] = in.nextInt();
ab[i][1] = in.nextInt();
if(ab[i][0] == 1) tf[ab[i][1]] = true;
}
for(int i = 0; i < n; i++) {
if(tf[ab[i][0]] && ab[i][1] == N){
System.out.println("POSSIBLE");
return;
}
}
System.out.println("IMPOSSIBLE");
}
}
| Main.java:17: error: ';' expected
boolean[] tf new boolean[n+1];
^
Main.java:17: error: not a statement
boolean[] tf new boolean[n+1];
^
2 errors
|
s051484453 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
const int maxx = 2e5 + 7;
int n, k;
int p[maxx];
map <int, int> mp;
int main() {
bool flg = 0;
cin >> n >> k;
for(int i = 1; i <= n; i++) cin >> p[i] >> mp[p[i]];
for(int i = 1; i <= n; i++) {
if(a[i] == 1 && mp[mp[a[i]]] == n) {
flg = 1;
break;
}
}
if(flg) puts("POSSIBLE");
else puts("IMPOSSIBLE");
} | a.cc: In function 'int main()':
a.cc:13:20: error: 'a' was not declared in this scope
13 | if(a[i] == 1 && mp[mp[a[i]]] == n) {
| ^
|
s513268018 | p03645 | C++ | #include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n,m;
cin >> n>>m;
vector<int> a,b;
for (int i = 0; i < m; ++i) {
pair<int, int> tmp;
cin >> tmp.first >> tmp.second;
if (tmp.first == 1) {
if (find(a.begin(), a.end(), tmp.second) == a.end()) {
a.push_back(tmp.second);
if (find(b.begin(), b.end(), tmp.second) != b.end()) {
cout << "POSSIBLE" << endl;
return 0;
}
}
if (tmp.second==n) {
if (find(b.begin(), b.end(), tmp.first) == b.end()) {
b.push_back(tmp.first);
if (find(a.begin(), a.end(), tmp.second) != a.end()) {
cout << "POSSIBLE" << endl;
return 0;
}
}
}
}
cout << "IMPOSSIBLE"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
34 | }
| ^
a.cc:6:12: note: to match this '{'
6 | int main() {
| ^
|
s076370234 | p03645 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define swap(type,x,y) do{type t=x;x=y;y=t;}while(0)
using namespace std;
void quick(vector<int> a, int left, int right) {
int pl = left;
int pr = right;
int x = a[(pl + pr) / 2];
do {
while (a[pl] < x)pl++;
while (a[pr] > x)pr--;
if (pl <= pr) {
swap(int, a[pl], a[pr]);
pl++;
pr--;
}
} while (pl <= pr);
if (left < pr) quick(a, left, pr);
if (pl < right) quick(a, pl, right);
}
int main() {
int n, m, i, j, k, s;
vector<int>a, x;
cin >> n >> m;
for (i = 0; i < m; i++) {
cin >> j >> k;
if (j == 1)
x.push_back(k);
if (k == n)
a.push_back(j);
}
k = x.size();
m = a.size();
if (k <= 0 && m <= 0) {
cout << "IMPOSSIBLE";
return 0;
}
for (i = 2; i < n; i++) {
if (search(x.begin(), x.end(), i) && search(a.begin(), a.end(), i)) {
cout << "POSSIBLE";
return 0;
}
}
cout << "IMPOSSIBLE";
return 0;
} | a.cc: In function 'int main()':
a.cc:50:51: error: no match for 'operator&&' (operand types are '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
50 | if (search(x.begin(), x.end(), i) && search(a.begin(), a.end(), i)) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| __normal_iterator<[...],[...]> __normal_iterator<[...],[...]>
a.cc:50:51: note: candidate: 'operator&&(bool, bool)' (built-in)
50 | if (search(x.begin(), x.end(), i) && search(a.begin(), a.end(), i)) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:50:51: note: no known conversion for argument 2 from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'bool'
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Searcher = int]':
a.cc:50:13: required from here
50 | if (search(x.begin(), x.end(), i) && search(a.begin(), a.end(), i)) {
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4186:24: error: expression cannot be used as a function
4186 | { return __searcher(__first, __last).first; }
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~
|
s625500547 | p03645 | C++ | #include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <sstream>
#include <cstdlib>
typedef long long ll;
using namespace std;
int main()
{
int N,M;
cin >> N >> M;
vector<int> dataa(M,0);
vector<int> datab(M,0);
for(int i=0;i<M;i++){
cin >> dataa[i] >> datab[i];
}
if (M==1){
cout << "IMPOSSIBLE" << endl;
return 0;
}
for (int i=0;i<M;i++){
if(datab[i]==N){
for(int j=0;j<M;j++){
if(dataa[i]==datab[j]){
if(dataa[j]==1){
cout << "POSSIBLE" << endl;
return 0;
}
}
}
}
}
cout << "IMPOSSIBLE" << endl;
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'vector' was not declared in this scope
14 | vector<int> dataa(M,0);
| ^~~~~~
a.cc:8:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
7 | #include <cstdlib>
+++ |+#include <vector>
8 | typedef long long ll;
a.cc:14:16: error: expected primary-expression before 'int'
14 | vector<int> dataa(M,0);
| ^~~
a.cc:15:16: error: expected primary-expression before 'int'
15 | vector<int> datab(M,0);
| ^~~
a.cc:17:24: error: 'dataa' was not declared in this scope
17 | cin >> dataa[i] >> datab[i];
| ^~~~~
a.cc:17:36: error: 'datab' was not declared in this scope
17 | cin >> dataa[i] >> datab[i];
| ^~~~~
a.cc:24:20: error: 'datab' was not declared in this scope
24 | if(datab[i]==N){
| ^~~~~
a.cc:26:36: error: 'dataa' was not declared in this scope
26 | if(dataa[i]==datab[j]){
| ^~~~~
|
s046449616 | p03645 | C++ | #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = 1e9;
const ll LINF = 1e18;
struct edge{int to,cost;};
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin >> n >> m;
vector<int> es[n];
int a,b;
for(int i=0;i<m;i++){
cin >> a >> b;
a--;b--;
es[a].push_back(b);
}
int dp[n];
d[0]=0;
for(int i=1;i<n;i++) d[i] = INF;
int e;
for(int i=0;i<n-1;i++){
for(int j=0;j<es[i].size();j++){
e = es[i][j];
if(d[e] > d[i]+1){
d[e] = d[i]+1;
}
}
}
cout << (d[n-1]<=2?"":"IM") << "POSSIBLE\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:45:9: error: 'd' was not declared in this scope; did you mean 'dp'?
45 | d[0]=0;
| ^
| dp
|
s182786802 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, M, a, b;
cin >> N >> M;
int i1[200001], iN[200001];
fill_n(i1, 200001, 0);
fill_n(i2, 200001, 0);
for(int i=0;i<M;i++){
cin >> a >> b;
if(a == 1)
i1[b] = 1;
if(b == N)
iN[a] = 1;
}
for(int i=2;i<N;i++){
if(i1[i] == 1 && iN[i] == 1){
cout << "POSSIBLE" << endl;
return 0;
}
}
cout << "IMPOSSIBLE" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:12: error: 'i2' was not declared in this scope; did you mean 'iN'?
9 | fill_n(i2, 200001, 0);
| ^~
| iN
|
s873629149 | p03645 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<int>vecx;
vector<int>vecy;
int main(){
int n,m,a,b,x=0,y=0;
cin>>n>>m;
for(int i=0;i<m;i++){
cin>>a>>b;
if(a==1){
vecx.push_back(b);
x++;
if(b==n){
vecy.push_back(a);
y++;
}
}
if(x==0||y==0){
cout<<"IMPOSSIBLE"<<endl;
return 0;
}
sort(vecx.begin(),vecx.end());
sort(vecy.begin(),vecy.end());
x=0,y=0;
while(x<=vecx.size()&&y<=vecy.size()){
if(vecx[x]==vecy[y]){
cout<<"POSSIBLE"<<endl;
return 0;
}
if(vecx[x]<vecy[y])x++;
else y++;
}
cout<<"IMPOSSIBLE"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:35:2: error: expected '}' at end of input
35 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.