submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s544146105 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
bool graph[8][8];
int dfs(int t, int N, bool visited) {
bool all_visited = true;
for(int i = 0; i < N; i++) {
if(visited[i] == false) {
all_visited = false;
}
}
if(all _visited) {
return 1;
}
int ret = 0;
for(int i = 0; i < N; i++) {
if(graph[t][i] == false) {
continue;
}
if(visited[i]) {
continue;
}
visited[i] = true;
ret += dfs(i, N, visited);
visited[i] = false;
}
return ret;
}
int main() {
int N, M;
cin >> N >> M;
for(int i = 0; i < N; i++) {
int a, b;
cin >> a >> b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
}
bool visited[8];
for(int i = 0; i < N; i++) {
visited[i] = false;
}
visited[0] = true;
cout << dfs(0, N, visited) << endl;
return 0;
} | a.cc: In function 'int dfs(int, int, bool)':
a.cc:10:15: error: invalid types 'bool[int]' for array subscript
10 | if(visited[i] == false) {
| ^
a.cc:14:6: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
14 | if(all _visited) {
| ^~~
| std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
158 | all = 0777,
| ^~~
a.cc:14:9: error: expected ')' before '_visited'
14 | if(all _visited) {
| ~ ^~~~~~~~~
| )
a.cc:24:15: error: invalid types 'bool[int]' for array subscript
24 | if(visited[i]) {
| ^
a.cc:28:12: error: invalid types 'bool[int]' for array subscript
28 | visited[i] = true;
| ^
a.cc:30:12: error: invalid types 'bool[int]' for array subscript
30 | visited[i] = false;
| ^
|
s034035072 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
bool graph[8][8];
int dfs(int t, int N, bool visited) {
bool all_visited = true;
for(int i = 0; i < N; i++) {
if(visited[i] == false) {
all_visited = false;
}
}
if(all _visited) {
return 1;
}
int ret = 0;
for(int i = 0; i < N; i++) {
if(graph[t][i] == false) {
continue;
}
if(visited[i]) {
continue;
}
visited[i] = true;
ret += dfs(i, N, visited);
visited[i] = false;
}
return ret;
}
int main() {
int N, M;
cin >> N >> M;
for(int i = 0; i < N; i++) {
int a, b;
cin >> a >> b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
}
bool visited[8];
for(int i = 0; i < N; i++) {
visited[i] = false;
}
visited[0] = true;
cout << dfs(0, N, visited) << endl;
} | a.cc: In function 'int dfs(int, int, bool)':
a.cc:10:15: error: invalid types 'bool[int]' for array subscript
10 | if(visited[i] == false) {
| ^
a.cc:14:6: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
14 | if(all _visited) {
| ^~~
| std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
158 | all = 0777,
| ^~~
a.cc:14:9: error: expected ')' before '_visited'
14 | if(all _visited) {
| ~ ^~~~~~~~~
| )
a.cc:24:15: error: invalid types 'bool[int]' for array subscript
24 | if(visited[i]) {
| ^
a.cc:28:12: error: invalid types 'bool[int]' for array subscript
28 | visited[i] = true;
| ^
a.cc:30:12: error: invalid types 'bool[int]' for array subscript
30 | visited[i] = false;
| ^
|
s158851571 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
bool graph[8][8];
int dfs(int t, int N, bool visited) {
bool all_visited = true;
for(int i = 0; i < N; i++) {
if(visited[i] == false) {
all_visited = false;
}
}
if(all _visited) {
return 1;
}
int ret = 0;
for(int i = 0; i < N; i++) {
if(graph[t][i] == false) {
continue;
}
if(visited[i]) {
continue;
}
visited[i] = true;
ret += dfs(t, N, visited);
visited[i] = false;
}
return ret;
}
int main() {
int N, M;
cin >> N >> M;
for(int i = 0; i < N; i++) {
int a, b;
cin >> a >> b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
}
bool visited[8];
for(int i = 0; i < N; i++) {
visited[i] = false;
}
visited[0] = true;
cout << dfs(0, N, visited) << endl;
} | a.cc: In function 'int dfs(int, int, bool)':
a.cc:10:15: error: invalid types 'bool[int]' for array subscript
10 | if(visited[i] == false) {
| ^
a.cc:14:6: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
14 | if(all _visited) {
| ^~~
| std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
158 | all = 0777,
| ^~~
a.cc:14:9: error: expected ')' before '_visited'
14 | if(all _visited) {
| ~ ^~~~~~~~~
| )
a.cc:24:15: error: invalid types 'bool[int]' for array subscript
24 | if(visited[i]) {
| ^
a.cc:28:12: error: invalid types 'bool[int]' for array subscript
28 | visited[i] = true;
| ^
a.cc:30:12: error: invalid types 'bool[int]' for array subscript
30 | visited[i] = false;
| ^
|
s616577280 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const double pi=acos(-1);
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += 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;
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 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>;
vector<bool> seen,finished;
int pos = -1;
int ca=0;
int f=0;
void dfs(const Graph &G, int v, int p) {
seen[v] = true;
for (auto nv : G[v]) {
if (nv == p) continue;
if (finished[nv]) continue;
if (seen[nv] && !finished[nv]) {
pos = nv;f++;
return;
}
dfs(G, nv, v);
// サイクル検出したならば真っ直ぐに抜けていく
if (pos != -1) {
return;}}
finished[v] = true;
}
mint calc(long long N, long long K) {
mint res = 1;
for (long long n = 0; n < K; ++n) {
res *= (N - n);
res /= (n + 1);
}
return res;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll N) : par(N) { //最初は全てが根であるとして初期化
for(ll i = 0; i < N; i++) par[i] = i;
}
ll root(ll x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x) return x;
return par[x] = root(par[x]);
}
void unite(ll x, ll y) { // xとyの木を併合
ll rx = root(x); //xの根をrx
ll ry = root(y); //yの根をry
if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
}
bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
ll rx = root(x);
ll ry = root(y);
return rx == ry;
}
};
int main() {
ll n,k; cin >> n>> k;
ll d[n+1][n+1]={{}};
rep(i,k){
ll a,b;
cin>>a>>b;
d[a][b]++;
d[b][a]++;}
ll v[n]={};
rep(i,n) v[i]=i+1;
ll ca = 0;
ll f = 0;
do {
for(ll i=0; i<n-1; i++){
if(d[v[i]][v[i+1]]!=1) {
f++;
break;}
}
if(f==0) ca++;
} while (next_permutation(v,v+n);
cout << ca << endl;}
| a.cc: In function 'int main()':
a.cc:153:33: error: expected ')' before ';' token
153 | } while (next_permutation(v,v+n);
| ~ ^
| )
|
s643879067 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const double pi=acos(-1);
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += 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;
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 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>;
vector<bool> seen,finished;
int pos = -1;
int ca=0;
int f=0;
void dfs(const Graph &G, int v, int p) {
seen[v] = true;
for (auto nv : G[v]) {
if (nv == p) continue;
if (finished[nv]) continue;
if (seen[nv] && !finished[nv]) {
pos = nv;f++;
return;
}
dfs(G, nv, v);
// サイクル検出したならば真っ直ぐに抜けていく
if (pos != -1) {
return;}}
finished[v] = true;
}
mint calc(long long N, long long K) {
mint res = 1;
for (long long n = 0; n < K; ++n) {
res *= (N - n);
res /= (n + 1);
}
return res;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll N) : par(N) { //最初は全てが根であるとして初期化
for(ll i = 0; i < N; i++) par[i] = i;
}
ll root(ll x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x) return x;
return par[x] = root(par[x]);
}
void unite(ll x, ll y) { // xとyの木を併合
ll rx = root(x); //xの根をrx
ll ry = root(y); //yの根をry
if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける
}
bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
ll rx = root(x);
ll ry = root(y);
return rx == ry;
}
};
int main() {
ll n,k; cin >> n>> k;
d[n+1][n+1]={{}};
rep(i,k){
ll a,b;
cin>>a>>b;
d[a][b]++;
d[b][a]++;}
ll v[n]={};
rep(i,n) v[i]=i+1;
ll ca = 0;
ll f = 0;
do {
for(ll i=0; i<n-1; i++){
if(d[v[i]][v[i+1]]!=1) {
f++;
break;}
}
if(f==0) ca++;
} while (next_permutation(v,v+n);
cout << ca << endl;} | a.cc: In function 'int main()':
a.cc:136:2: error: 'd' was not declared in this scope
136 | d[n+1][n+1]={{}};
| ^
a.cc:153:33: error: expected ')' before ';' token
153 | } while (next_permutation(v,v+n);
| ~ ^
| )
|
s558807753 | p03805 | C++ | #include "pch.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int counter;
void dfs(vector<vector<int>> &G, int s, int depth, vector<bool> &seen) {
if (depth == n) {
counter++;
return;
}
for (int i = 0; i < G[s].size(); i++) {
if (seen[G[s][i]] == true) {
continue;
}
seen[G[s][i]] = true;
dfs(G, G[s][i], depth+1, seen);
seen[G[s][i]] = false;
}
}
int main() {
int m;
cin >> n >> m;
counter = 0;
vector < vector<int>> G(n + 1);
//グラフ隣接リスト読み込み
int a, b;
for (int i = 1; i <= m; i++) {
cin >> a >> b;
G[a].push_back(b);
G[b].push_back(a);
}
int depth = 1;
vector<bool> seen(n + 1, false);
// for (int i = 1; i <= n; i++) {
int i = 1;
// if (seen[i]) { continue; }
seen[i] = true;
dfs(G, i, depth, seen);
// }
cout << counter << endl;
return 0;
} | a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s141074294 | p03805 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
using P = pair<int,int>;
const int nmax = 8;
bool graph[nmax][nmax];
int dfs(int v, int n, bool visited[nmax]){
bool all_visited = true;
for(int i = 0; i < n; i++){
if(visited[i] == false){
all_visited = false;
}
}
if(all_visited){
return 1;
}
int ret = 0;
for(int i = 0; i < n; i++){
if(graph[v][i] == false) continue;
if(visited[i]) continue;
visited[i] = true;
ret += dfs(i, n, visited);
visited[i] = false;
}
return ret;
}
int main(){
int n, m;
cin >> n >> m;
for(int i = 0; i < m; i++){
int a, b;
cin >> a >> b;
graph[a - 1][b - 1] = graph[b - 1][a - 1] = true;
}
bool visited[nmax];
for(int i = 0; i < n; i++){
visited[i] = false;
}
visited[0] = true;
cout << dfs(0, n, nmax) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:54:23: error: invalid conversion from 'int' to 'bool*' [-fpermissive]
54 | cout << dfs(0, n, nmax) << endl;
| ^~~~
| |
| int
a.cc:9:28: note: initializing argument 3 of 'int dfs(int, int, bool*)'
9 | int dfs(int v, int n, bool visited[nmax]){
| ~~~~~^~~~~~~~~~~~~
|
s456064444 | p03805 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> G(8,vector<int>(8));
vector<bool> visit(8,false);
int ans;
int n, m;
/*
目的: 頂点を受け取り, 条件を満たすかどうかを探索する. 何も返さない.
*/
void dfs(int v){
bool allVisited = true;
for (int i = 0; i < n; i++) if (i != v && visit[i] == false) allVisited = false;
if (allVisited){
ans++;
return;
}
visit[v] = true;
for (auto p : G[v]){
if (!visit[p]) dfs(p);
}
visit[v] = false;
}
int main(void){
cin >> n >> m;
for(int i = 0; i < m; i++){
int a, b;
cin >> a >> b;
a--,b--;
G[a].push_back(b);
G[b].push_back(a);
}
ans = 0;
visit[0] = true;
dfs(0);
cout << ans << endl;
return 0;
}
| a.cc: In function 'void dfs(int)':
a.cc:18:47: error: reference to 'visit' is ambiguous
18 | for (int i = 0; i < n; i++) if (i != v && visit[i] == false) allVisited = false;
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:2:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc:25:5: error: reference to 'visit' is ambiguous
25 | visit[v] = true;
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc:28:14: error: reference to 'visit' is ambiguous
28 | if (!visit[p]) dfs(p);
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc:31:5: error: reference to 'visit' is ambiguous
31 | visit[v] = false;
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc: In function 'int main()':
a.cc:46:5: error: reference to 'visit' is ambiguous
46 | visit[0] = true;
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
|
s551265440 | p03805 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> G(8,vector<int>(8));
vector<bool> visit(8,false);
int ans;
int n, m;
/*
目的: 頂点を受け取り, 条件を満たすかどうかを探索する. 何も返さない.
*/
void dfs(int v){
bool allVisited = true;
for (int i = 0; i < n; i++) if (i != v && !visit[i]) allVisited = false;
if (allVisited){
ans++;
return;
}
visit[v] = true;
for (auto p : G[v]){
if (!visit[p]) dfs(p);
}
visit[v] = false;
}
int main(void){
cin >> n >> m;
for(int i = 0; i < m; i++){
int a, b;
cin >> a >> b;
a--,b--;
G[a].push_back(b);
G[b].push_back(a);
}
ans = 0;
visit[0] = true;
dfs(0);
cout << ans << endl;
return 0;
}
| a.cc: In function 'void dfs(int)':
a.cc:18:48: error: reference to 'visit' is ambiguous
18 | for (int i = 0; i < n; i++) if (i != v && !visit[i]) allVisited = false;
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:2:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc:25:5: error: reference to 'visit' is ambiguous
25 | visit[v] = true;
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc:28:14: error: reference to 'visit' is ambiguous
28 | if (!visit[p]) dfs(p);
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc:31:5: error: reference to 'visit' is ambiguous
31 | visit[v] = false;
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
a.cc: In function 'int main()':
a.cc:46:5: error: reference to 'visit' is ambiguous
46 | visit[0] = true;
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:7:14: note: 'std::vector<bool> visit'
7 | vector<bool> visit(8,false);
| ^~~~~
|
s925160203 | p03805 | C++ |
// delete when proceedig next
#define EXE
#ifdef EXE
// -------------------------------------------------------
#include <iostream>
#include <string>
#include <stdio.h>
#include <cassert>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int result_num = 0;
int N = 3;
int M = 3;
// pair<int, int> ab0(1, 2);
vector<pair<int, int>> ab_map{ make_pair(1,2), make_pair(1,3), make_pair(2,3) };
// string s;
//vector<pair<int, int>> find_reverse(multimap<int, int> map, int i) {
vector<pair<int, int>> find_reverse(vector<pair<int, int>> map, int i) {
vector<pair<int, int>> out_vec;
int index = 0;
for (auto m : map) {
if (m.second == i) {
out_vec.push_back(make_pair(index, m.first));
}
index++;
}
return out_vec;
}
vector<pair<int, int>> find(vector<pair<int, int>> map, int i) {
vector<pair<int, int>> out_vec;
int index = 0;
for (auto m : map) {
if (m.first == i) {
out_vec.push_back(make_pair(index, m.second));
}
index++;
}
return out_vec;
}
void a(const int i, vector<bool> foot_print, bool reverse) {
foot_print[i] = true;
// for (auto ab : ab_map) {
int dist = 0;
if (reverse) {
dist = ab_map[i].first;
}
else {
dist = ab_map[i].second;
}
if (all_of(foot_print.begin(), foot_print.end(), [](int x) { return x; })) {
result_num++;
return;
}
auto found_vec = find(ab_map, dist);
for (auto vec : found_vec) {
if (foot_print[vec.first] == true) continue;
a(vec.first, foot_print, false /*reverse*/);
}
auto found_reverse_vec = find_reverse(ab_map, dist);
for (auto vec : found_reverse_vec) {
if (foot_print[vec.first] == true) continue;
a(vec.first, foot_print, true /*reverse*/);
}
// }
}
int main() {
#ifdef DEBUG
#else
cin >> sx >> sy >> tx >> ty;
#endif
vector<bool> foot_print(ab_map.size(), false);
int index = 0;
for (auto ab : ab_map) {
if (ab.first != 1)continue;
a(index, foot_print, false /*reverse*/);
index++;
}
std::cout << result_num << endl;
#ifdef DEBUG
int z;
cin >> z;
#endif
return 0;
}
// -------------------------------------------------------
#endif | a.cc: In function 'int main()':
a.cc:82:16: error: 'sx' was not declared in this scope
82 | cin >> sx >> sy >> tx >> ty;
| ^~
a.cc:82:22: error: 'sy' was not declared in this scope
82 | cin >> sx >> sy >> tx >> ty;
| ^~
a.cc:82:28: error: 'tx' was not declared in this scope; did you mean 'tm'?
82 | cin >> sx >> sy >> tx >> ty;
| ^~
| tm
a.cc:82:34: error: 'ty' was not declared in this scope; did you mean 'tm'?
82 | cin >> sx >> sy >> tx >> ty;
| ^~
| tm
|
s281769646 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
map<int,vector<int>> P;
set<string> RT;
vector<bool> ans;
int count=0;
void prog(int a,vector<bool>T){
T.at(a-1)=true;
if(T==ans){
count++;
return;
}
for(int i:P.at(a)){
if(T.at(i-1))continue;
prog(i,T);
}
}
int main (){
int N,M;
cin >> N >> M;
for(int i=0;i<M;i++){
int j,k;
cin >> j >> k;
P[j].push_back(k);
P[k].push_back(j);
}
ans=vector<bool>(N,true);
prog(1,vector<bool>(N,false));
cout << count << endl;
}
| a.cc: In function 'void prog(int, std::vector<bool>)':
a.cc:11:9: error: reference to 'count' is ambiguous
11 | count++;
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:7:5: note: 'int count'
7 | int count=0;
| ^~~~~
a.cc: In function 'int main()':
a.cc:36:13: error: reference to 'count' is ambiguous
36 | cout << count << endl;
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:7:5: note: 'int count'
7 | int count=0;
| ^~~~~
|
s832522687 | p03805 | 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();
connectingNumsArray2 = new boolean[N][N];
for(i = 0; i < N; i++){
for(j = 0; j < N; j++){
// 初期値はfalse
connectingNumsArray2[i][j] = false;
}
}
for(i = 0; i < M; i++){
int a = sc.nextInt();
int b = sc.nextInt();
connectingNumsArray2[a][b] = true;
connectingNumsArray2[b][a] = true;
}
List<Integer> pathList = new ArrayList<>();
pathList.add(1);
int ans = 0;
makePathList(1, pathList);
system.out.println(ans);
}
public static void makePathList(int currentNum, List<Integer> pathList){
for(boolean[] nextNumCandidate : connectingNumsArray2){
for(i = 0; i < N; i++){
if(nextNumCandidate[i] == false){
if(pathList.length == N - 1){
ans = ans + 1;
}
} else {
pathList.add(i + 1);
makePathList(i + 1, pathList);
}
}
}
}
}
| Main.java:10: error: cannot find symbol
connectingNumsArray2 = new boolean[N][N];
^
symbol: variable connectingNumsArray2
location: class Main
Main.java:11: error: cannot find symbol
for(i = 0; i < N; i++){
^
symbol: variable i
location: class Main
Main.java:11: error: cannot find symbol
for(i = 0; i < N; i++){
^
symbol: variable i
location: class Main
Main.java:11: error: cannot find symbol
for(i = 0; i < N; i++){
^
symbol: variable i
location: class Main
Main.java:12: error: cannot find symbol
for(j = 0; j < N; j++){
^
symbol: variable j
location: class Main
Main.java:12: error: cannot find symbol
for(j = 0; j < N; j++){
^
symbol: variable j
location: class Main
Main.java:12: error: cannot find symbol
for(j = 0; j < N; j++){
^
symbol: variable j
location: class Main
Main.java:14: error: cannot find symbol
connectingNumsArray2[i][j] = false;
^
symbol: variable connectingNumsArray2
location: class Main
Main.java:14: error: cannot find symbol
connectingNumsArray2[i][j] = false;
^
symbol: variable i
location: class Main
Main.java:14: error: cannot find symbol
connectingNumsArray2[i][j] = false;
^
symbol: variable j
location: class Main
Main.java:18: error: cannot find symbol
for(i = 0; i < M; i++){
^
symbol: variable i
location: class Main
Main.java:18: error: cannot find symbol
for(i = 0; i < M; i++){
^
symbol: variable i
location: class Main
Main.java:18: error: cannot find symbol
for(i = 0; i < M; i++){
^
symbol: variable i
location: class Main
Main.java:22: error: cannot find symbol
connectingNumsArray2[a][b] = true;
^
symbol: variable connectingNumsArray2
location: class Main
Main.java:23: error: cannot find symbol
connectingNumsArray2[b][a] = true;
^
symbol: variable connectingNumsArray2
location: class Main
Main.java:31: error: package system does not exist
system.out.println(ans);
^
Main.java:35: error: cannot find symbol
for(boolean[] nextNumCandidate : connectingNumsArray2){
^
symbol: variable connectingNumsArray2
location: class Main
Main.java:36: error: cannot find symbol
for(i = 0; i < N; i++){
^
symbol: variable i
location: class Main
Main.java:36: error: cannot find symbol
for(i = 0; i < N; i++){
^
symbol: variable i
location: class Main
Main.java:36: error: cannot find symbol
for(i = 0; i < N; i++){
^
symbol: variable N
location: class Main
Main.java:36: error: cannot find symbol
for(i = 0; i < N; i++){
^
symbol: variable i
location: class Main
Main.java:37: error: cannot find symbol
if(nextNumCandidate[i] == false){
^
symbol: variable i
location: class Main
Main.java:38: error: cannot find symbol
if(pathList.length == N - 1){
^
symbol: variable length
location: variable pathList of type List<Integer>
Main.java:38: error: cannot find symbol
if(pathList.length == N - 1){
^
symbol: variable N
location: class Main
Main.java:39: error: cannot find symbol
ans = ans + 1;
^
symbol: variable ans
location: class Main
Main.java:39: error: cannot find symbol
ans = ans + 1;
^
symbol: variable ans
location: class Main
Main.java:42: error: cannot find symbol
pathList.add(i + 1);
^
symbol: variable i
location: class Main
Main.java:43: error: cannot find symbol
makePathList(i + 1, pathList);
^
symbol: variable i
location: class Main
28 errors
|
s348417751 | p03805 | C++ | #include <iostream>
using namespace std;
bool graph[8][8] = {false};
int dfs(int iterate, bool * visited, int n, int m) {
bool all_visited = true;
for (int i = 0; i < n; i++) {
if (visited[i] == false)
all_visited = false;
}
if (all_visited)
return 1;
int rval = 0;
for (int i = 0; i < n; i++) {
if (graph[v][i] == false) {
continue;
}
if (visited[i] == true) {
continue;
}
visited[i] = true;
ret += dfs(i, visited, n, m);
}
return ret;
}
int main() {
int n, m;
cin >> n >> m;
int a, b;
for (int i = 0; i < m; i++) {
cin >> a >> b;
graph[a - 1][b - 1] = graph[b - 1][a - 1] = true;
}
bool visited[n] = {false};
visited[0] = true;
cout << dfs(0, visited, n, m) << endl;
return 0;
} | a.cc: In function 'int dfs(int, bool*, int, int)':
a.cc:17:15: error: 'v' was not declared in this scope
17 | if (graph[v][i] == false) {
| ^
a.cc:24:5: error: 'ret' was not declared in this scope
24 | ret += dfs(i, visited, n, m);
| ^~~
a.cc:26:10: error: 'ret' was not declared in this scope
26 | return ret;
| ^~~
|
s432425272 | p03805 | 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();
List<Integer> list = new ArrayList<>();
// 全部1つのListに入れちゃう
for(int i = 0 ; i < 2 * M - 1; i++) {
list.add(sc.nextInt());
}
// 「自分と繋がってる点」リストを点の種類分つくって1つのリストにまとめるよ
List<connectingNumsList> connectingNumsListList = new ArrayList<>();
for(int i = 0; i < N ; i++) {
String currentNumString = String.valueOf(i);
String connectingNumsList = currentNumString.concat("List");
List<Integer> connectingNumsList =
}
}
} | Main.java:17: error: illegal character: '\u3000'
?List<connectingNumsList> connectingNumsListList = new ArrayList<>();
^
Main.java:23: error: illegal start of expression
}
^
2 errors
|
s556417420 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; } //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
int n,m;
cin >> n >> m;
vectro<vector<int>> k(n,vector<int>(n,-1));
rep(i,m){
int a,b;
cin >> a >> b;
a--;
b--;
k[a][b]=1;
k[b][a]=1;
}
int u[n-1];
int ans=0;
rep(i,n-1)u[i]=1+i;
do{
if(k[0][u[0]]==-1)continue;
int y=0;
rep(i,n-2)if(k[u[i]][u[i+1]]==-1)y++;
if(y==0)ans++;
}while(next_permutation(u,u+n-1));
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:13:3: error: 'vectro' was not declared in this scope
13 | vectro<vector<int>> k(n,vector<int>(n,-1));
| ^~~~~~
a.cc:13:20: error: expected primary-expression before '>' token
13 | vectro<vector<int>> k(n,vector<int>(n,-1));
| ^~
a.cc:13:23: error: 'k' was not declared in this scope
13 | vectro<vector<int>> k(n,vector<int>(n,-1));
| ^
|
s819438696 | p03805 | C++ | #include <iostream>
#include <vector>
#include <algorithm> // next_permutation(順列)
#include <numeric>
using namespace std;
bool G[10][10]; // グラフを隣接行列で管理
int main() {
int N, M;
cin >> N >> M;
for ( int i = 0; i < M; i++ ) {
int a, b;
cint >> a >> b;
G[a-1][b-1] == G[b-1][a-1] = true;
}
// 順列
vector<int> ord(N);
for ( int i = 0; i < N; i++ ) ord[i] = i;
int ans = 0;
do {
if ( ord[0] != 0 ) break; //始点は1である必要あり
bool ok = true;
for ( int i = 0; i + 1 < N; i++ ) {
int from = ord[i];
int to = ord[i+1];
if ( !G[from][to] ) ok = false;
}
if ( ok ) ans++;
} while ( next_permutation(ord.begin(), ord.end()) ); //next_permutationを利用するには昇順に並び替えておく必要あり
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:14:5: error: 'cint' was not declared in this scope; did you mean 'uint'?
14 | cint >> a >> b;
| ^~~~
| uint
a.cc:15:17: error: lvalue required as left operand of assignment
15 | G[a-1][b-1] == G[b-1][a-1] = true;
| ~~~~~~~~~~~~^~~~~~~~~~~~~~
|
s415109725 | p03805 | C++ | #include<bits/stdc++.h>
#define ll long long
#define P pair<int,int>
#define PP pair<P,int>
using namespace std;
int n, m, sum;
vector<vector<int>> g(10);
int dfs(vector<int>v, int x, sum){
if(v.size() == n)return sum;
for(auto i:g[x]){
bool had = false;
for(auto j:v){
if(i == j) had = true;
}
if(had) continue;
vector<int>u = v;
u.push_back(i);
return dfs(u ,i, );
}
return 0;
}
int main(){
} | a.cc:11:30: error: 'sum' is not a type
11 | int dfs(vector<int>v, int x, sum){
| ^~~
a.cc: In function 'int dfs(std::vector<int>, int, int)':
a.cc:23:26: error: expected primary-expression before ')' token
23 | return dfs(u ,i, );
| ^
|
s138858670 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
void OnestrokePath(int n,vector<vector<int>> &ABC,vector<bool> &ok,int &ans) {
bool ok2 = true;
for(int i = 0; i < ok.size(); i++) {
if(ok[i] == false && i != n) {
ok2 = false;
}
}
if(ok2) {
ans++;
return;
}
ok[n] = true;
for(int i = 0; i < ABC[n].size(); i++) {
if(ABC[n][i] == true) {
continue;
}
OnestrokePath(ABC[n][i],ABC,ok);
}
ok[n] = false;
return;
}
int main() {
int N,M;
cin >> N >> M;
vector<vector<int>>ABC(N);
vector<bool>ok(N,false);
for(int i = 0; i < M; i++) {
int a,b;
cin >> a >> b;
a--;
b--;
ABC[a].push_back(b);
ABC[b].push_back(a);
}
int ans = 0;
OnestrokePath(0,ABC,ok,ans);
cout << ans << endl;
}
| a.cc: In function 'void OnestrokePath(int, std::vector<std::vector<int> >&, std::vector<bool>&, int&)':
a.cc:19:22: error: too few arguments to function 'void OnestrokePath(int, std::vector<std::vector<int> >&, std::vector<bool>&, int&)'
19 | OnestrokePath(ABC[n][i],ABC,ok);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:3:6: note: declared here
3 | void OnestrokePath(int n,vector<vector<int>> &ABC,vector<bool> &ok,int &ans) {
| ^~~~~~~~~~~~~
|
s369154663 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
int ans = 0;
void OnestrokePath(int n,vector<vector<int>> &ABC,vector<bool> &ok) {
bool ok2 = true;
for(int i = 0; i < ok.size(); i++) {
if(ok[i] == false && i != n) {
ok2 = false;
}
}
if(ok2) {
ans+;
return;
}
ok[n] = true;
for(int i = 0; i < ABC[n].size(); i++) {
if(ABC[n][i] == true) {
continue;
}
OnestrokePath(ABC[n][i],ABC,ok);
}
return;
}
int main() {
int N,M;
cin >> N >> M;
vector<vector<int>>AB(N);
vector<bool>flag(N,false);
for(int i = 0; i < N; i++) {
int a,b;
cin >> a >> b;
a--;
b--;
AB[a].push_back(b);
AB[b].push_back(a);
}
OnestrokePath(0,AB,flag);
cout << ans << endl;
}
| a.cc: In function 'void OnestrokePath(int, std::vector<std::vector<int> >&, std::vector<bool>&)':
a.cc:12:13: error: expected primary-expression before ';' token
12 | ans+;
| ^
|
s274338066 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
int ans = 0;
void OnestrokePath(int n,vector<vector<int>> &ABC,vector<bool> &ok) {
bool ok2 = true;
for(int i = 0; i < ok.size(); i++) {
if(ok == false && i != n) {
ok2 = false;
}
}
if(ok2) {
ans+;
return;
}
ok[n] = true;
for(int i = 0; i < ABC[n].size(); i++) {
if(ABC[n][i] == true) {
continue;
}
OnestrokePath(ABC[n][i],ABC,ok);
}
return;
}
int main() {
int N,M;
cin >> N >> M;
vector<vector<int>>AB(N);
vector<bool>flag(N,false);
for(int i = 0; i < N; i++) {
int a,b;
cin >> a >> b;
a--;
b--;
AB[a].push_back(b);
AB[b].push_back(a);
}
OnestrokePath(0,AB,flag);
cout << ans << endl;
} | a.cc: In function 'void OnestrokePath(int, std::vector<std::vector<int> >&, std::vector<bool>&)':
a.cc:7:15: error: no match for 'operator==' (operand types are 'std::vector<bool>' and 'bool')
7 | if(ok == false && i != n) {
| ~~~^~~~~~~~
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'bool'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'bool'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
7 | if(ok == false && i != n) {
| ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::pair<_T1, _T2>'
7 | if(ok == false && i != n) {
| ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::reverse_iterator<_Iterator>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::reverse_iterator<_Iterator>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::move_iterator<_IteratorL>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::move_iterator<_IteratorL>'
7 | if(ok == false && i != n) {
| ^~~~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::fpos<_StateT>'
7 | if(ok == false && i != n) {
| ^~~~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'const std::allocator<_CharT>'
7 | if(ok == false && i != n) {
| ^~~~~
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:7:18: note: 'std::vector<bool>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
7 | if(ok == false && i != n) {
| ^~~~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_ |
s543984129 | p03805 | C++ | #include<bits/ctdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<vector<bool>> graph(n,vector<bool> (n,false));
for(int i = 0; i < m ; ++i){
int a,b;
cin >> a>>b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
}
vector<int> v(n);
for( int i = 0; i<n; ++i) v[i] = i;
int ans = 0;
do{
bool ok = true;
for( int i = 1;i < n;++i) if(graph[v[i-1]][v[i]] == false) ok = false;
if(ok) ans++;
} while ( next_permutation(++v.begin(),v.end()));
cout << ans << endl;
} | a.cc:1:9: fatal error: bits/ctdc++.h: No such file or directory
1 | #include<bits/ctdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s656450696 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
const int nmax = 8;
bool graph[nmax][nmax];
int dfs(int v; int N; bool visited[nmax]){
bool all_visited = true;
for(int i = 0; i < N;++i) if(!visited[i]) all_visited=false;
if(all_visited) return 1;
int ret = 0;
for(int i=0;i<N;++i){
if(!graph[v][i] || visited[i]) continue;
visited[i] = true;
ret+= dfs(i,N,visited);
visited[i] = false;
}
return ret;
}
int main(){
int N, M;
cin >> N >> M;
for(int i = 0; i < M ; ++i){
int a,b;
cin >> a >> b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
}
bool visited[nmax];
for(int i = 0; i < N ; ++i) visited[i] = false;
visited[0] = true;
cout << dfs(0,N,visited) << endl;
} | a.cc:6:14: error: expected ')' before ';' token
6 | int dfs(int v; int N; bool visited[nmax]){
| ~ ^
| )
a.cc:6:41: error: expected initializer before ')' token
6 | int dfs(int v; int N; bool visited[nmax]){
| ^
a.cc: In function 'int main()':
a.cc:31:14: error: too many arguments to function 'int dfs(int)'
31 | cout << dfs(0,N,visited) << endl;
| ~~~^~~~~~~~~~~~~
a.cc:6:5: note: declared here
6 | int dfs(int v; int N; bool visited[nmax]){
| ^~~
|
s145942103 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
const int nmax = 8;
bool graph[nmax][nmax];
int dfs(int v;int N;bool visited[nmax]){
bool all_visited = true;
for(int i = 0; i < N;++i) if(!visited[i]) all_visited=false;
if(all_visited) return 1;
int ret = 0;
for(int i=0;i<N;++i){
if(!graph[v][i] || visited[i]) continue;
visited[i] = true;
ret+= dfs(i,N,visited);
visited[i] = false;
}
return ret;
}
int main(){
int N, M;
cin >> N >> M;
bool visited[nmax];
for(int i = 0; i < N ; ++i){
int a,b;
cin >> a >> b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
visited[i] = false;
}
visited[0] = true;
cout << dfs(0,N,visited) << endl;
} | a.cc:6:14: error: expected ')' before ';' token
6 | int dfs(int v;int N;bool visited[nmax]){
| ~ ^
| )
a.cc:6:39: error: expected initializer before ')' token
6 | int dfs(int v;int N;bool visited[nmax]){
| ^
a.cc: In function 'int main()':
a.cc:31:14: error: too many arguments to function 'int dfs(int)'
31 | cout << dfs(0,N,visited) << endl;
| ~~~^~~~~~~~~~~~~
a.cc:6:5: note: declared here
6 | int dfs(int v;int N;bool visited[nmax]){
| ^~~
|
s406847186 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
const int nmax = 8;
bool graph[nmax][nmax];
int dfs(int v,int N,bool visited[nmax]){
bool all_visited = true;
for(int i = 0;i<N;++i){
if(visited[i] == false){
all_visited = false;
break;
}
}
if(all_visited){
return 1;
}
int ret = 0;
for(int i = 0; i<N;++i){
if(graph[v][i] == false) continue;
if(visited[i] == true) continue;
visited[i] = true;
ret+=dfs(i,N,visited);
visited[i] = false;
}
return ret;
}
int main(){
int N,M;
cin >> N >> M;
int a,b;
for(int i=0;i<M;++i){
cin >> a >> b;
a--;
b--;
graph[a][b] = graph[b][a] = true;
}
bool visited[nmax];
for(int i = 0; i < nmax ; ++i){
visited[i] = false
}
visited[0] = true;
cout << bfs(0,N,visited) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:46:23: error: expected ';' before '}' token
46 | visited[i] = false
| ^
| ;
47 | }
| ~
a.cc:51:11: error: 'bfs' was not declared in this scope; did you mean 'ffs'?
51 | cout << bfs(0,N,visited) << endl;
| ^~~
| ffs
|
s739657789 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
bool hantei(vector<int> &j,vector<vector<int>> &A){
for(vector<int> &i:A)
if(i==j)
return true;
return false;
}
int main(){
int N,M;
cin>>N>>M;
vector<vector<int>> A(M,vector<int>(2));
for(vector<int> &i:A){
int j,k;
cin>>j>>k;
i={j-1,k-1};
}
vector<int> v={};
for(int i=1;i<N;i++)
v.push_back(i);
int k=0;
do{
if(!hantei({0,v.at(0)},A))
continue;
for(int i=0;i<N-1;i++)
if(!hantei({v.at(i),v.at(i+1)},A))
continue;
k++;
}while (next_permutation(v.begin(), v.end()));
} | a.cc: In function 'int main()':
a.cc:25:15: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
25 | if(!hantei({0,v.at(0)},A))
| ~~~~~~^~~~~~~~~~~~~~~
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:678:7: note: after user-defined conversion: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
a.cc:4:26: note: initializing argument 1 of 'bool hantei(std::vector<int>&, std::vector<std::vector<int> >&)'
4 | bool hantei(vector<int> &j,vector<vector<int>> &A){
| ~~~~~~~~~~~~~^
a.cc:28:17: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
28 | if(!hantei({v.at(i),v.at(i+1)},A))
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: after user-defined conversion: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
a.cc:4:26: note: initializing argument 1 of 'bool hantei(std::vector<int>&, std::vector<std::vector<int> >&)'
4 | bool hantei(vector<int> &j,vector<vector<int>> &A){
| ~~~~~~~~~~~~~^
|
s665646223 | p03805 | C++ | // #include <bits/stdc++.h>
// typedef long long int ll;
// using namespace std;
// int dfs(int v, vector<vector<int>> A, vector<int> visit, int &count)
// {
// bool all_flag = 1;
// for (int i = 0; i < visit.size(); i++)
// {
// if (visit[i] == 0)
// {
// all_flag = 0;
// }
// }
// if (all_flag == 1)
// {
// //count++;
// return 1;
// }
// int mas=0;
// for (int w : A[v])
// {
// if (visit[w] == 0)
// {
// visit[w] = 1;
// mas+=dfs(w, A, visit, count);
// visit[w] = 0;
// }
// }
// return mas;
// }
// int main()
// {
// int N, M;
// cin >> N >> M;
// vector<vector<int>> A(N, vector<int>(0));
// for (int i = 0; i < N; i++)
// {
// int a, b;
// cin >> a >> b;
// A[a - 1].push_back(b - 1);
// A[b - 1].push_back(a - 1);
// }
// vector<int> visit(N, 0);
// visit[0] = 1;
// int count = 0;
// count =dfs(0, A, visit, count);
// cout << count << endl;
// return 0;
// }
const int nmax=8;
bool graph[nmax][nmax];
int dfs(int v,int N,bool visited[nmax]){
bool all_visited=true;
for(int i=0;i<N;++i){
if(visited[i]==false)
all_visited=false;
}
if(all_visited){
return 1;
}
int ret=0;
for(int i=0;i<N;++i){
if(graph[v][i]==false) continue;
if(visited[i]) continue;
visited[i]=true;
ret+=dfs(i,N,visited);
visited[i]=false;
}
return ret;
}
int main(void){
int N,M;
cin >> N >> M;
for(int i=0;i<M;++i){
int A,B;
cin >> A >> B;
graph[A-1][B-1]=graph[B-1][A-1]=true;
}
bool visited[nmax];
for(int i=0;i<N;++i){
visited[i]=false;
}
visited[0]=true;
cout << dfs(0,N,visited) << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:103:2: error: 'cin' was not declared in this scope
103 | cin >> N >> M;
| ^~~
a.cc:117:2: error: 'cout' was not declared in this scope
117 | cout << dfs(0,N,visited) << endl;
| ^~~~
a.cc:117:30: error: 'endl' was not declared in this scope
117 | cout << dfs(0,N,visited) << endl;
| ^~~~
|
s935820819 | p03805 | C++ | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int dfs(int v, vector<vector<int>> A, vector<int> visit, int &count)
{
bool all_flag = 1;
for (int i = 0; i < visit.size(); i++)
{
if (visit[i] == 0)
{
all_flag = 0;
}
}
if (all_flag == 1)
{
count++;
return 0;
}
for (int w : A[v])
{
if (visit[w] == 0)
{
stop_flag = 0;
visit[w] = 1;
dfs(w, A, visit, count);
visit[w] = 0;
}
}
return 0;
}
int main()
{
int N, M;
cin >> N >> M;
vector<vector<int>> A(N, vector<int>(0));
for (int i = 0; i < N; i++)
{
int a, b;
cin >> a >> b;
A[a - 1].push_back(b - 1);
A[b - 1].push_back(a - 1);
}
vector<int> visit(N, 0);
visit[0] = 1;
int count = 0;
dfs(0, A, visit, count);
cout << count << endl;
return 0;
} | a.cc: In function 'int dfs(int, std::vector<std::vector<int> >, std::vector<int>, int&)':
a.cc:29:13: error: 'stop_flag' was not declared in this scope
29 | stop_flag = 0;
| ^~~~~~~~~
|
s304848968 | p03805 | C++ | #include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int dfs(int v, vector<vector<int>> A, vector<int> visit, int &count)
{
bool stop_flag = 1;
visit[v] = 1;
for (int w :A[v])
{
if (visit[w] == 0)
{
stop_flag = 0;
dfs(w, A, visit,count);
}
}
if(stop_flag ==1){
for(int i=0;i<visit.size();i++){
if(visit[i]==0){
return 0;
}
}
count++;
return 0;
}
}
int main()
{
int N, M;
cin >> N >> M;
vector<vector<int>> A(N, vector<int>(0));
for (int i = 0; i < N; i++)
{
int a, b;
cin >> a >> b;
A[a - 1].push_back(b - 1) ;
A[b - 1].push_back(a - 1) ;
}
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int dfs(int v, vector<vector<int>> A, vector<int> visit, int &count)
{
bool stop_flag = 1;
visit[v] = 1;
for (int w : A[v])
{
if (visit[w] == 0)
{
stop_flag = 0;
dfs(w, A, visit, count);
}
}
for (int i = 0; i < visit.size(); i++)
{
if (visit[i] == 0)
{
return 0;
}
}
count++;
return 0;
}
int main()
{
int N, M;
cin >> N >> M;
vector<vector<int>> A(N, vector<int>(0));
for (int i = 0; i < N; i++)
{
int a, b;
cin >> a >> b;
A[a - 1].push_back(b - 1);
A[b - 1].push_back(a - 1);
}
vector<int> visit(N, 0);
visit[0] = 1;
int count = 0;
dfs(0, A, visit, count);
cout << count << endl;
return 0;
}
vector<int> visit(N,0);
visit[0] = 1;
int count=0;
dfs(0,A,visit,count);
cout << count << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:60:1: error: a function-definition is not allowed here before '{' token
60 | {
| ^
a.cc:86:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
86 | int main()
| ^~
a.cc:86:9: note: remove parentheses to default-initialize a variable
86 | int main()
| ^~
| --
a.cc:86:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:87:1: error: a function-definition is not allowed here before '{' token
87 | {
| ^
a.cc: In function 'int dfs(int, std::vector<std::vector<int> >, std::vector<int>, int&)':
a.cc:36:1: warning: control reaches end of non-void function [-Wreturn-type]
36 | }
| ^
|
s251091229 | p03805 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;
bool G[10][10]; // グラフを隣接行列で管理する。無方向なので対称にする。
int main() {
int N, M; cin >> N >> M;
for (int i = 0; i < M; ++i) {
int a, b; cin >> a >> b; --a, --b; //全部-1してる
G[a][b] = G[b][a] = true; //道が繋がっているところはture
}
// 順列
vector<int> su(N);
for (int i = 0; i < N; ++i) su[i] = i; //ベクトルに0〜n-1を格納
// 順列を全部試すa
int ans = 0;
do {
if (su[0] != 0) break;
bool ok = true;
for (int i = 0; i + 1 < N; ++i) {
int from = su[i];
int to = su[i+1];
if (!G[from][to]) ok = false;
}
if (ok) ++ans;
} while (next_permutation(su.begin(), su.end()));
cout << res << endl;
} | a.cc: In function 'int main()':
a.cc:34:13: error: 'res' was not declared in this scope; did you mean 'rep'?
34 | cout << res << endl;
| ^~~
| rep
|
s644132469 | p03805 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MessagePack;
using MessagePack.Resolvers;
namespace Capp
{
class Program
{
public enum En
{
a
,b
,c
,d
,e
,f
}
static void Main(string[] args)
{
var c = new Solve();
c.S();
}
}
public class Solve
{
List<int>[] es = new List<int>[10];
int n;
int m;
int res = 0;
int t = 0;
void rec(int x)
{
if (t == (1 << n) - 1)
{
res++;
return;
}
foreach(var v in es[x])
{
if ((t & (1 << v)) > 0)
continue;
t |= (1 << v);
rec(v);
t ^= (1 << v);
}
}
public void S()
{
var nm = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
n = nm[0];
m = nm[0];
for (int i = 0; i < n; i++)
{
es[i] = new List<int>();
}
for (int i = 0; i < m; i++)
{
var s = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
var a = s[0] - 1;
var b = s[1] - 1;
es[a].Add(b);
es[b].Add(a);
}
t = 1;
rec(0);
Console.WriteLine(res);
}
}
public class Test<T> : ITest<T>
{
public string S { get; set; }
}
public interface ITest<out T>
{
string S { get; set; }
}
struct c
{
public string s { get; set; }
private dynamic _d;
public dynamic d { get { return _d; }}
public void Setd(dynamic d)
{
_d = d;
}
}
class AsTest
{
internal async Task<int> AsyncMethod(int x)
{
var t1 = Task.Run(() =>
{
Thread.Sleep(10000);
return 10 * x;
});
var res = await t1;
Console.WriteLine($"asyncmethod {res}");
return res;
}
}
}
| a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Threading;
| ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
5 | using System.Threading.Tasks;
| ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'MessagePack'
6 | using MessagePack;
| ^~~~~~~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'MessagePack'
7 | using MessagePack.Resolvers;
| ^~~~~~~~~~~
a.cc:12:15: error: expected ':' before 'enum'
12 | public enum En
| ^~~~~
| :
a.cc:23:26: error: 'string' has not been declared
23 | static void Main(string[] args)
| ^~~~~~
a.cc:23:35: error: expected ',' or '...' before 'args'
23 | static void Main(string[] args)
| ^~~~
a.cc:12:16: error: new types may not be defined in a return type
12 | public enum En
| ^~~~
a.cc:12:16: note: (perhaps a semicolon is missing after the definition of 'Capp::Program::En')
a.cc:12:16: error: two or more data types in declaration of 'Main'
a.cc:29:6: error: expected ';' after class definition
29 | }
| ^
| ;
a.cc:31:5: error: expected unqualified-id before 'public'
31 | public class Solve
| ^~~~~~
a.cc:78:5: error: expected unqualified-id before 'public'
78 | public class Test<T> : ITest<T>
| ^~~~~~
a.cc:83:5: error: expected unqualified-id before 'public'
83 | public interface ITest<out T>
| ^~~~~~
a.cc:90:15: error: expected ':' before 'string'
90 | public string s { get; set; }
| ^~~~~~~
| :
a.cc:90:16: error: 'string' does not name a type
90 | public string s { get; set; }
| ^~~~~~
a.cc:91:16: error: expected ':' before 'dynamic'
91 | private dynamic _d;
| ^~~~~~~~
| :
a.cc:91:17: error: 'dynamic' does not name a type
91 | private dynamic _d;
| ^~~~~~~
a.cc:92:15: error: expected ':' before 'dynamic'
92 | public dynamic d { get { return _d; }}
| ^~~~~~~~
| :
a.cc:92:16: error: 'dynamic' does not name a type
92 | public dynamic d { get { return _d; }}
| ^~~~~~~
a.cc:93:15: error: expected ':' before 'void'
93 | public void Setd(dynamic d)
| ^~~~~
| :
a.cc:93:26: error: 'dynamic' has not been declared
93 | public void Setd(dynamic d)
| ^~~~~~~
a.cc:97:6: error: expected ';' after struct definition
97 | }
| ^
| ;
a.cc: In member function 'void Capp::c::Setd(int)':
a.cc:95:13: error: '_d' was not declared in this scope; did you mean 'd'?
95 | _d = d;
| ^~
| d
a.cc: At global scope:
a.cc:100:9: error: 'internal' does not name a type
100 | internal async Task<int> AsyncMethod(int x)
| ^~~~~~~~
a.cc:114:6: error: expected ';' after class definition
114 | }
| ^
| ;
|
s770443689 | p03805 | C | #include<stdio.h>
int n;
int d[8][8];
int u[8];
int f(int now,int len){
if(len == 1){
return 1;
}
u[now] = 1;
int ans = 0;
for(int i = 0;i < n;i ++){
if(u[i] == 0 && d[now][i] != 0){
ans += f(i,len-1);
}
u[now] = 0;
return 0;
}
int main(void){
int m;
scanf("%d %d",&n,&m);
for(int i = 0;i < m;i ++){
int a , b;
scanf("%d %d",&a,&b);
d[a-1][b-1] = 1;
d[b-1][a-1] = 1;
}
int ans = f(0,n);
printf("%d\n",ans);
return 0;
} | main.c: In function 'f':
main.c:36:1: error: expected declaration or statement at end of input
36 | }
| ^
|
s885908431 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<vector<bool>> adj(n,vector<bool>(n,false));
vector<int> v(n);
for ( int i = 0; i < m; i++){
int a,b;
cin >> a >> b;
a--; b--;
adj.at(a).at(b) = adj.at(a).at(b) = true;
}
for ( int i = 0; i < n; i++){
v[i] = i;
}
int ans = 0;
do{
bool ok = true;
for(int i = 1; i < n ; i++){
if ( adj.at(v.at(i-1)).at(v.at(i)) == false){
ok = false;
break;
}
}
if ( ok ) ans++;
} while ( next_permutation(++v.begin(),v.end()));
cout << ans << endl;
}} | a.cc:35:2: error: expected declaration before '}' token
35 | }}
| ^
|
s747678044 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<vector<bool>> adj(n,vector<bool>(n,false));
vector<int> v(n);
for ( int i = 0; i < m; i++){
int a,b;
cin >> a >> b;
a--; b--;
adj.at(a).at(b) = adj.at(a).at(b) true;
}
for ( int i = 0; i < n; i++){
v[i] = i;
}
int ans = 0;
do{
bool ok = true;
for(int i = 1; i < n ; i++){
if ( adj.at(v.at(i-1)).at(v.at(i)) == false){
ok = false;
break;
}
}
if ( ok ) ans++;
} while ( next_permutation(++v.begin(),v.end()));
cout << ans << endl;
}} | a.cc: In function 'int main()':
a.cc:14:38: error: expected ';' before 'true'
14 | adj.at(a).at(b) = adj.at(a).at(b) true;
| ^ ~~~~
| ;
a.cc: At global scope:
a.cc:35:2: error: expected declaration before '}' token
35 | }}
| ^
|
s135428024 | p03805 | C++ | #incliude<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<vector<bool>> adj(n,vector<bool>(n,false));
vector<int> v(n);
for ( int i = 0; i < m; i++){
int a,b;
cin >> a >> b;
a--; b--;
adj.at(a).at(b) = adj.at(a).at(b) true;
}
for ( int i = 0; i < n; i++){
v[i] = i;
}
int ans = 0;
do{
bool ok = true;
for(int i = 1; i < n ; i++){
if ( adj.at(v.at(i-1)).at(v.at(i)) == false){
ok = false;
break;
}
}
if ( ok ) ans++;
} while ( next_permutation(++v.begin(),v.end()));
cout << ans << endl;
}} | a.cc:1:2: error: invalid preprocessing directive #incliude; did you mean #include?
1 | #incliude<bits/stdc++.h>
| ^~~~~~~~
| include
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
5 | cin >> n >> m;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | #incliude<bits/stdc++.h>
a.cc:7:3: error: 'vector' was not declared in this scope
7 | vector<vector<bool>> adj(n,vector<bool>(n,false));
| ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
+++ |+#include <vector>
1 | #incliude<bits/stdc++.h>
a.cc:7:17: error: expected primary-expression before 'bool'
7 | vector<vector<bool>> adj(n,vector<bool>(n,false));
| ^~~~
a.cc:8:10: error: expected primary-expression before 'int'
8 | vector<int> v(n);
| ^~~
a.cc:14:5: error: 'adj' was not declared in this scope
14 | adj.at(a).at(b) = adj.at(a).at(b) true;
| ^~~
a.cc:18:5: error: 'v' was not declared in this scope
18 | v[i] = i;
| ^
a.cc:26:12: error: 'adj' was not declared in this scope
26 | if ( adj.at(v.at(i-1)).at(v.at(i)) == false){
| ^~~
a.cc:26:19: error: 'v' was not declared in this scope
26 | if ( adj.at(v.at(i-1)).at(v.at(i)) == false){
| ^
a.cc:32:32: error: 'v' was not declared in this scope
32 | } while ( next_permutation(++v.begin(),v.end()));
| ^
a.cc:32:13: error: 'next_permutation' was not declared in this scope
32 | } while ( next_permutation(++v.begin(),v.end()));
| ^~~~~~~~~~~~~~~~
a.cc:34:3: error: 'cout' was not declared in this scope
34 | cout << ans << endl;
| ^~~~
a.cc:34:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:19: error: 'endl' was not declared in this scope
34 | cout << ans << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | #incliude<bits/stdc++.h>
a.cc: At global scope:
a.cc:35:2: error: expected declaration before '}' token
35 | }}
| ^
|
s806125951 | p03805 | C++ | nnnnnnnnn | a.cc:1:1: error: 'nnnnnnnnn' does not name a type
1 | nnnnnnnnn
| ^~~~~~~~~
|
s622828817 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
vector<bool> seen;//訪れたか否か
int count1 = 1;//今まで幾つの頂点に訪れたか
int DFS(vector<vector<int>> &G, int v, int N){
bool all_seen = true;//全て訪れたかの判定
for(int i = 0; i < N; i++){
if(!seen[i]){
all_seen = false;
}
}
bool all_seen = true;//全て訪れたかの判定
if(all_seen){
return 1;
//全て訪れたなら1を返す
}
int ans = 0;
//vから行ける場所に行く
for(int next_v: G[v]){
if(seen[next_v]) continue;//既に訪れているなら別の頂点へ
seen[next_v] = true;//頂点vは訪れた
ans += DFS(G, next_v, N);
seen[next_v] = false;//頂点vに訪れたことをリセット
}
return ans;
}
int main(){
int N, M;
cin >> N >> M;
//グラフの受け取り
vector<vector<int>> G(N);
for(int i = 0; i < M; i++){
int a, b;
cin >> a >> b;
G[a-1].push_back(b-1);
G[b-1].push_back(a-1);
}
seen.assign(N, false);
seen[0] = true;
cout << DFS(G, 0, N) << endl;
}
| a.cc: In function 'int DFS(std::vector<std::vector<int> >&, int, int)':
a.cc:17:8: error: redeclaration of 'bool all_seen'
17 | bool all_seen = true;//全て訪れたかの判定
| ^~~~~~~~
a.cc:10:8: note: 'bool all_seen' previously declared here
10 | bool all_seen = true;//全て訪れたかの判定
| ^~~~~~~~
|
s872619751 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
vector<bool> seen;//訪れたか否か
int count = 1;//今まで幾つの頂点に訪れたか
int ans = 0;
int DFS(vector<vector<int>> &G, int v, int N){
seen[v] = true;//頂点vは訪れた
if(count == N) ans++;
//vから行ける場所に行く
for(int next_v: G[v]){
//すでに訪れているなら無視
if(seen[next_v]){
continue;
}
count++;
DFS(G, next_v, N);
}
return ans;
}
int main(){
int N, M;
cin >> N >> M;
//グラフの受け取り
vector<vector<int>> G(N);
for(int i = 0; i < M; i++){
int a, b;
cin >> a >> b;
G[a-1].push_back(b-1);
G[b-1].push_back(a-1);
}
cout << DFS(G, O, N) << endl;
}
| a.cc: In function 'int DFS(std::vector<std::vector<int> >&, int, int)':
a.cc:12:6: error: reference to 'count' is ambiguous
12 | if(count == N) ans++;
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:6:5: note: 'int count'
6 | int count = 1;//今まで幾つの頂点に訪れたか
| ^~~~~
a.cc:21:5: error: reference to 'count' is ambiguous
21 | count++;
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:6:5: note: 'int count'
6 | int count = 1;//今まで幾つの頂点に訪れたか
| ^~~~~
a.cc: In function 'int main()':
a.cc:43:18: error: 'O' was not declared in this scope
43 | cout << DFS(G, O, N) << endl;
| ^
|
s585412509 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int N,M;
Graph graph(N);
vector<bool> seen;
int res = 0;
void do_dfs(int root,int times)
{
for(auto i: graph[root])
{
if(root == 1)
{
seen = vector<bool>(N + 1,false);
seen[1] = true;
}
if(seen[i]) continue;
seen[i] = true;
do_dfs(i,times + 1);
}
if(times == N) res++;
}
void calc()
{
cin >> N >> M;
int i,a,b;
graph.resize(N + 1);
for(i = 1;i <= N;i++)
{
cin >> a >> b;
graph[a].push_back(b);
graph[b].push_back(a);
}
do_dfs(1,1);
cout << res << '\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
calc();
}
| a.cc:5:1: error: 'Graph' does not name a type
5 | Graph graph(N);
| ^~~~~
a.cc: In function 'void do_dfs(int, int)':
a.cc:11:17: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
11 | for(auto i: graph[root])
| ^~~~~
| isgraph
a.cc: In function 'void calc()':
a.cc:28:5: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
28 | graph.resize(N + 1);
| ^~~~~
| isgraph
|
s001496952 | p03805 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MAX_N 105
#define MAX_M 11
#define PI 3.14159265359
#define rep(i,n) for(int i=0; i<n; ++i)
#define INF 1001001001
typedef pair<int, int> P;
int main() {
int n, m;
cin >> n >> m;
int path[n+1][n+1];
memset(path, 0, sizeof(path));
rep(i,m) {
int a, b;
cin >> a >> b;
--a, --b;
path[a][b] = 1;
path[b][a] = 1;
}
int root[n];
rep(i,n) root[i] = i;
int ans = 0;
do {
bool flg = true;
for (int i=0; i<n-1; ++i) {
if (!path[root[i]][root[i+1]]) flg = false;
}
if (flg) ++ans;
} while (next_permutation(root+1, root+n));
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:5: error: 'memset' was not declared in this scope
22 | memset(path, 0, sizeof(path));
| ^~~~~~
a.cc:9:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
8 | #include <set>
+++ |+#include <cstring>
9 | using namespace std;
a.cc:42:14: error: 'next_permutation' was not declared in this scope
42 | } while (next_permutation(root+1, root+n));
| ^~~~~~~~~~~~~~~~
|
s641727738 | p03805 | C++ | #include "bits/stdc++.h"
#include <unordered_set>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define Sort(a) sort(a.begin(),a.end())
#define cSort(a,cmp) sort(a.begin(),a.end(),cmp)
#define reSort(a) sort(a.rbegin(), a.rend())
static const ll llMAX = numeric_limits<long long>::max();
static const int intMAX = numeric_limits<int>::max();
static const ll llMIN = numeric_limits<long long>::min();
static const int intMIN = numeric_limits<int>::min();
static const ll d_5 = 100000;
static const ll d9_7 = 1000000007;
static const ll d_9 = 1000000000;
static const double PI=3.14159265358979323846;
/*
このBaseedgeクラスをなぜかクラスとして認識してくれない
*/
template<class T>
class Baseedge {
public:
int number;
int v1;
int v2;
T length;
T cost;
Baseedge(int inputfrom , int inputto, T inputlength,T inputcost,int inputnumber){
this.v1 = inputfrom;
this.v2 = inputto;
this.number = inputnumber;
this.length = inputlength;
this.cost = inputcost;
}
virtual int nextvertex(int from)=0;
};
template<class T>
class Uniedge : public Baseedge {
public:
Uniedge(int inputfrom , int inputto, T inputlength,T inputcost,int inputnumber){
Baseedge<T>(inputfrom,inputto,inputlength,inputcost, inputnumber);
}
int nextvertex(int from) override {
return this.v2;
}
};
template<class T>
class Biedge : public Baseedge {
public:
Biedge(int inputfrom , int inputto, T inputlength,T inputcost,int inputnumber){
Baseedge<T>(inputfrom,inputto,inputlength,inputcost, inputnumber);
}
int nextvertex(int from) override {
if(this.v1==from){
return this.v2;
}else if(this.v2==from){
return this.v1;
}else{
printf("ERROR Invalid number \n");
return -1;
}
}
};
template<class T>
class graph{
public:
int n;//ノード数
vector<Baseedge<ll> > es;
struct vertex{
int number;
set<int> edges;
};
vector<vertex> vs;
//constructor
graph(int input){
n=input;
vs=vector<vertex>(n);
for(int i=0;i<n;i++){
vs[i].number=i;
}
}
void bind_uni(int from,int to,T len,T cost){
//1方向につなぐ
int num=es.size();
Baseedge<T> newedge = new Uniedge<T>(from,to,len,cost,num);
es.push_back(newedge);
vs[from].edges.insert(num);
}
void bind_bi(int v1,int v2,T len,T cost){
//1方向につなぐ
int num=es.size();
Baseedge<T> newedge = new Biedge<T>(v1,v2,len,cost,num);
es.push_back(newedge);
vs[v1].edges.insert(num);
vs[v2].edges.insert(num);
}
int ans=0;
void DFS(int now,T length,T cost,set<int> past,int pre=-1){
if(past.find(now)!=past.end())return;
past.insert(now);
if(past.size()==n){
ans++;
return ;
}
for(auto i:vs[now].edges){
int next=es[i].nextvertex(now);
if(next==pre)continue;
DFS(next,length+es[i].length,cost+es[i].cost,past,now);
}
}
void BFS(int ini){
struct opera{
int now;
int pre;
T len;
T cost;
}
queue<opera> opes;
opes.push_back({ini,-1,0,0});
while(opes.size()>0){
int now=opes.front().now;
int pre = opes.front().pre;
T len = opes.front().len;
T cost = opes.front().cost;
for(auto i:vs[i].edges){
int next=es[i].nextvertex(now);
if(next==pre)continue;
opes.push_back({next,now,len+es[i].length,cost+es[i].cost});
}
opes.pop_front();
}
}
};
int main(void){
int n;
cin>>n;
graph<ll> G(n);
int m;
rep(i,m){
int a,b;
cin>>a>>b;
a--;b--;
G.bind_bi(a,b,1,1);
}
G.DFS(0,0,0,{},-1);
cout<<G.ans<<endl;
return 0;
}
//clang++ -g -fsanitize=address -fno-omit-frame-pointer 1.cpp -o test.exe
//<<std::setprecision(30)
//重複削除
/* std::sort(vec.begin(), vec.end());
vec.erase(std::unique(vec.begin(), vec.end()), vec.end());*/
//ペアの全探索
/*do{
int s=0;
for(int i=0;i<n/2;i++)s+=v[i]^v[i+n/2];
r=max(s,r);
reverse(v.begin()+n/2,v.end());
}while(next_permutation(v.begin(),v.end()));*/
| a.cc:49:33: error: expected class-name before '{' token
49 | class Uniedge : public Baseedge {
| ^
a.cc:61:32: error: expected class-name before '{' token
61 | class Biedge : public Baseedge {
| ^
a.cc: In member function 'void graph<T>::BFS(int)':
a.cc:133:18: error: invalid declarator before 'opes'
133 | queue<opera> opes;
| ^~~~
a.cc:134:5: error: 'opes' was not declared in this scope; did you mean 'es'?
134 | opes.push_back({ini,-1,0,0});
| ^~~~
| es
a.cc:140:21: error: 'i' was not declared in this scope
140 | for(auto i:vs[i].edges){
| ^
a.cc: In instantiation of 'class Biedge<long long int>':
a.cc:107:27: required from 'void graph<T>::bind_bi(int, int, T, T) [with T = long long int]'
107 | Baseedge<T> newedge = new Biedge<T>(v1,v2,len,cost,num);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:158:14: required from here
158 | G.bind_bi(a,b,1,1);
| ~~~~~~~~~^~~~~~~~~
a.cc:67:9: error: 'int Biedge<T>::nextvertex(int) [with T = long long int]' marked 'override', but does not override
67 | int nextvertex(int from) override {
| ^~~~~~~~~~
a.cc: In instantiation of 'void graph<T>::bind_bi(int, int, T, T) [with T = long long int]':
a.cc:158:14: required from here
158 | G.bind_bi(a,b,1,1);
| ~~~~~~~~~^~~~~~~~~
a.cc:107:17: error: cannot allocate an object of abstract type 'Baseedge<long long int>'
107 | Baseedge<T> newedge = new Biedge<T>(v1,v2,len,cost,num);
| ^~~~~~~
a.cc:32:7: note: because the following virtual functions are pure within 'Baseedge<long long int>':
32 | class Baseedge {
| ^~~~~~~~
a.cc:46:17: note: 'int Baseedge<T>::nextvertex(int) [with T = long long int]'
46 | virtual int nextvertex(int from)=0;
| ^~~~~~~~~~
a.cc:107:17: error: cannot declare variable 'newedge' to be of abstract type 'Baseedge<long long int>'
107 | Baseedge<T> newedge = new Biedge<T>(v1,v2,len,cost,num);
| ^~~~~~~
|
s882282152 | p03805 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお
int n, m, ans, node1, node2, x[9]={1};
vector<int> G(9);
void dfs(int p, int q){
if(q==n) {
ans++;
return;
}
for(auto a : G[p]){
if(!x[a]){
x[a] = 1;
dfs(a,q+1);
x[a] = 0;
}
}
}
int main() {
cin >> n >> m;
rep(i,m){
cin >> node1 >> node2;
node1--; node2--;
G[node1].push_back(node2);
G[node2].push_back(node1);
}
dfs(0,1);
cout << ans << endl;
return 0;
}
| a.cc: In function 'void dfs(int, int)':
a.cc:31:21: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
31 | for(auto a : G[p]){
| ^
| std::begin
In file included from /usr/include/c++/14/string:53,
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/range_access.h:114:37: note: 'std::begin' declared here
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
a.cc:31:21: error: 'end' was not declared in this scope; did you mean 'std::end'?
31 | for(auto a : G[p]){
| ^
| std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc: In function 'int main()':
a.cc:44:18: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)node1))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
44 | G[node1].push_back(node2);
| ^~~~~~~~~
a.cc:45:18: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)node2))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
45 | G[node2].push_back(node1);
| ^~~~~~~~~
|
s294835236 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
int N, M;
cin >> N >> M;
vector<vector<bool>> G(N, vector<bool>(N, false));
rep(i, M){
int a, b;
cin >> a >> b;
G.at(a-1).at(b-1) = true;
G.at(b-1).at(a-1) = true;
}
vector<int> vec(N);
rep(i, N) vec.at(i) = i;
int ans = 0;
do {
bool flag = true;
for(int i = 0; i < N - 1 ; i++){
if (!G.at(vec.at(i)).at(vec.at(i+1))){
flag = false;
break;
}
}
if(flag) ans++;
} while (next_permutation(v.begin()+1, v.end()));
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:30:29: error: 'v' was not declared in this scope
30 | } while (next_permutation(v.begin()+1, v.end()));
| ^
|
s539261623 | p03805 | C++ | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 100
// size: specify sizeof(str)
int get_str(char *str, int size) {
if(!fgets(str, size, stdin)) return -1;
return 0;
}
int get_int(void) {
int num;
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return 0;
sscanf(line, "%d", &num);
#else
#error
#endif
return num;
}
int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return -1;
sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
return 0;
}
void swap(int *a, int *b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
void reversed(int *a, int size) {
int *b = malloc(sizeof(int)*size);
memcpy(b, a, sizeof(int)*size);
int i;
for(i = 0; i < size; i++) {
a[i] = b[size-1-i];
}
}
// in-place(C++ like function)
int next_permutation(int *arr, int size) {
int i, k;
if(!size || size==1) return 0;
// step1.
for(k = size-2; k >= 0; k--) {
if(arr[k+1] > arr[k]) break;
}
if(k < 0) {
// reversed
reversed(arr, size);
return 0;
}
for(i = size-1; i >= 0; i--) {
if(arr[i] < arr[k]) continue;
break;
}
swap(&arr[i], &arr[k]);
reversed(&arr[k+1], size-1-k);
return 1;
}
#define VERTEXES_MAX 8
int main(void) {
int vs, es;
static char graph[VERTEXES_MAX][VERTEXES_MAX];
get_int2(&vs, &es);
int i;
for(i = 0; i < es; i++) {
int v1, v2;
get_int2(&v1, &v2);
// 1-indexed -> 0-indexed
v1--; v2--;
// undirected
graph[v1][v2] = graph[v2][v1] = 1;
}
int arr[VERTEXES_MAX];
for(i = 0; i < vs; i++) arr[i] = i;
int cnt = 0;
do {
// starting point must be 0
if(arr[0] != 0) break;
#ifdef DEBUG
for(i = 0; i < vs; i++) printf("%d ", arr[i]);
putchar('\n');
#endif
int flag = 1;
for(i = 1; i < vs; i++) {
if(graph[arr[i-1]][arr[i]]) continue;
flag = 0;
break;
}
if(flag) cnt++;
} while(next_permutation(arr, vs));
printf("%d\n", cnt);
return 0;
} | a.cc: In function 'void reversed(int*, int)':
a.cc:46:20: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
46 | int *b = malloc(sizeof(int)*size);
| ~~~~~~^~~~~~~~~~~~~~~~~~
| |
| void*
|
s323928131 | p03805 | C++ | #include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>
#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)
#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))
using namespace std;
typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;
// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
};
int dp[1 << 8][8];
int f(int mask, int last, VEC(VEC(int))& edges)
{
const int n = edges.size();
if (mask == (1 << n) - 1)
return 1;
int& ans = dp[mask][last];
if (ans >= 0)
return ans;
ans = 0;
for(int next : edges[last])
if (!(mask & (1 << next)))
ans += f(mask | (1 << next), next, edges);
return ans;
}
int main(int argc, char **argv)
{
io_init();
// Actual program code starts here.
int N, M;
cin >> N >> M;
VEC(VEC(int)) edges(N);
FOR(i, 0, M) {
int a, b;
cin >> a >> b;
a--;b--;
edges[a].push_back(b);
edges[b].push_back(a);
}
memset(dp, -1, sizeof dp);
cout << f(1, 0, edges) << endl;
return 0;
};
| a.cc: In function 'int main(int, char**)':
a.cc:79:5: error: 'memset' was not declared in this scope
79 | memset(dp, -1, sizeof dp);
| ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
14 | #include <cmath>
+++ |+#include <cstring>
15 |
|
s994835836 | p03805 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
bool G[10][10];
int main(){}
int n,m;
cin >> n >> m;
rep(i,m){
int a,b;
cin >> a >> b;
a--; b--;
G[a][b] = G[b][a] = true;
}
vector<int> ord(n);
rep(i,n) ord[i] = i;
int res = 0;
do {
if(ord[0] != 0)break;
bool ok = true;
for(int i = 0;i + 1 < n;i++){
int from = ord[i];
int to = ord[i+1];
if(!G[from][to]) ok = false;
}
if(ok) res++;
}
while (next_permutation(ord.begin(),ord.end()));
cout << res << endl;
} | a.cc:8:5: error: 'cin' does not name a type
8 | cin >> n >> m;
| ^~~
a.cc:2:18: error: expected unqualified-id before 'for'
2 | #define rep(i,n) for(int i = 0;i < (n);i++)
| ^~~
a.cc:9:5: note: in expansion of macro 'rep'
9 | rep(i,m){
| ^~~
a.cc:9:9: error: 'i' does not name a type
9 | rep(i,m){
| ^
a.cc:2:32: note: in definition of macro 'rep'
2 | #define rep(i,n) for(int i = 0;i < (n);i++)
| ^
a.cc:9:9: error: 'i' does not name a type
9 | rep(i,m){
| ^
a.cc:2:40: note: in definition of macro 'rep'
2 | #define rep(i,n) for(int i = 0;i < (n);i++)
| ^
a.cc:2:18: error: expected unqualified-id before 'for'
2 | #define rep(i,n) for(int i = 0;i < (n);i++)
| ^~~
a.cc:16:5: note: in expansion of macro 'rep'
16 | rep(i,n) ord[i] = i;
| ^~~
a.cc:16:9: error: 'i' does not name a type
16 | rep(i,n) ord[i] = i;
| ^
a.cc:2:32: note: in definition of macro 'rep'
2 | #define rep(i,n) for(int i = 0;i < (n);i++)
| ^
a.cc:16:9: error: 'i' does not name a type
16 | rep(i,n) ord[i] = i;
| ^
a.cc:2:40: note: in definition of macro 'rep'
2 | #define rep(i,n) for(int i = 0;i < (n);i++)
| ^
a.cc:18:5: error: expected unqualified-id before 'do'
18 | do {
| ^~
a.cc:28:5: error: expected unqualified-id before 'while'
28 | while (next_permutation(ord.begin(),ord.end()));
| ^~~~~
a.cc:29:5: error: 'cout' does not name a type
29 | cout << res << endl;
| ^~~~
a.cc:30:1: error: expected declaration before '}' token
30 | }
| ^
|
s908537413 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
const int nmax = 8;
bool G[nmax][nmax];
int DFS(int v, int N, bool has_visited[nmax]) {
bool has_visited_all = true;
for (int i = 0; i < N; i++) {
if (!has_visited[i]) has_visited_all = false;
}
if (has_visited_all) {
return 1;
}
int ret = 0;
for (int i = 0; i < N; i++) {
if (!G[v][i]) continue;
if (has_visited[v]) continue;
has_visited[v] = true;
ret += dfs(i, N, has_visited);
has_visited[i] = false;
}
return true;
}
int main() {
int N, M; cin >> N >> M;
for (int i = 0; i < M; i++) {
int A, B; cin >> A >> B;
G[A-1][B-1] = G[B-1][A-1] = true;
}
bool has_visited[nmax];
for (int i = 0; i < N; i++) has_visited[i] = false;
cout << DFS(0, N. has_visited) << endl;
return 0;
} | a.cc: In function 'int DFS(int, int, bool*)':
a.cc:22:12: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
22 | ret += dfs(i, N, has_visited);
| ^~~
| ffs
a.cc: In function 'int main()':
a.cc:36:21: error: request for member 'has_visited' in 'N', which is of non-class type 'int'
36 | cout << DFS(0, N. has_visited) << endl;
| ^~~~~~~~~~~
|
s570141849 | p03805 | C++ | #include <iostream>
using namespace std;
int N, M;
bool G[8][8] = {};
int main() {
cin >> N >> M;
for(int i = 0; i < M; ++i) {
int a, b; cin >> a >> b;
G[a-1][b-1] = G[b-1][a-1] = true;
}
// 全順列を生成
int linked_count = 0;
int p[8] = {0, 1, 2, 3, 4, 5, 6, 7};
do {
bool is_linked = true;
// N = 1のとき i は [0, 0]
// N = 2のとき i は [0, 0]
// N = 3のとき i は [0, 1]
// iは始点となるノード番号-1
for(int i = 0; i < N-1 && is_linked; ++i) {
is_linked = G[p[i]][p[i+1]];
}
if(is_linked) ++linked_count;
} while(next_permutation(p + 1, p + N)); // N = 3のとき [p+1, p+2] = [p+1, p+3)
cout << linked_count << endl;
}
| a.cc: In function 'int main()':
a.cc:29:13: error: 'next_permutation' was not declared in this scope
29 | } while(next_permutation(p + 1, p + N)); // N = 3のとき [p+1, p+2] = [p+1, p+3)
| ^~~~~~~~~~~~~~~~
|
s281609923 | p03805 | 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, m, a, s, t;
in2(n, m);
a = 0;
vector<ll> c(n - 1);
rep(i, n)
c[i] = i + 1;
vector<vector<ll>> d(n, vector<ll> (0));
bool h;
rep(i, m){
in2(s, t);
d[s - 1].pb(t - 1);
d[t - 1].pb(s - 1);
}
do{
h = true;
rep(i, d[0].size()){
if(c[0] == d[0][i])
break;
if(i == d[0].size() - 1)
h = false;
}
rep(i, n - 2){
s = c[i];
if(d[s] == 0)
h = false;
else{
rep(j, d[s].size()){
if(c[i + 1] == d[s][j])
break;
if(j == d[s].size() - 1)
h = false;
}
}
}
if(h)
a++;
}while(next_permutation(all(c)));
out(a);
memi;
}
| a.cc: In function 'int main()':
a.cc:41:15: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} and 'int')
41 | if(d[s] == 0)
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
41 | if(d[s] == 0)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::pair<_T1, _T2>'
41 | if(d[s] == 0)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::move_iterator<_IteratorL>'
41 | if(d[s] == 0)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::move_iterator<_IteratorL>'
41 | if(d[s] == 0)
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:41:18: note: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::fpos<_StateT>'
41 | if(d[s] == 0)
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 't |
s615411953 | p03805 | 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, m, a, s, t;
in2(n, m);
a = 0;
vector<ll> c(n - 1);
rep(i, n)
c[i] = i + 1;
vector<vector<ll>> d(n, vector<ll>);
bool h;
rep(i, m){
in2(s, t);
d[s - 1].pb(t - 1);
d[t - 1].pb(s - 1);
}
do{
h = true;
rep(i, d[0].size()){
if(c[0] == d[0][i])
break;
if(i == d[0].size() - 1)
h = false;
}
rep(i, n - 1){
rep(j, d[c[i]].size()){
if(c[i + 1] == d[c[i]][j])
break;
if(j == d[c[i]].size() - 1)
h = false;
}
}
if(h)
a++;
}while(next_permutation(all(c)));
out(a);
memi;
} | a.cc: In function 'int main()':
a.cc:24:37: error: expected primary-expression before ')' token
24 | vector<vector<ll>> d(n, vector<ll>);
| ^
|
s981900358 | p03805 | C++ | あ | a.cc:1:1: error: '\U00003042' does not name a type
1 | あ
| ^~
|
s715024529 | p03805 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int find_num(int n, int k, vector<int> &inp) {
set<int> num;
if (k=2) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j){
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))));
}
}
}
}
else if (k=3) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
for (int k=0; k<n; k++) {
if (i!=j && j!=k && k!=i) {
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))));
}
}
}
}
}
else {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j) {
for (int k=0; k<n; k++) {
if (i!=k && j!=k) {
for (int l=0; l<n; l++) {
if (i!=l && j!=l && k!=l) {
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))+to_string(inp.at(l))));
}
}
}
}
}
}
}
}
return set.size();
}
int main() {
int n, k;
cin >> n >> k;
vector<int> inp(n);
for (int i=0; i<n; i++) {
cin >> inp.at(i);
}
cout << find_num(n, k, inp) << endl;
} | a.cc: In function 'int find_num(int, int, std::__debug::vector<int>&)':
a.cc:44:15: error: missing template arguments before '.' token
44 | return set.size();
| ^
|
s205806051 | p03805 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int find_num(int n, int k, vector<int> &inp) {
set<int> num;
if (k=2) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j){
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))));
}
}
}
}
else if (k=3) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
for (int k=0; k<n; k++) {
if (i!=j && j!=k && k!=i) {
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))));
}
}
}
}
}
else {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j) {
for (int k=0; k<n; k++) {
if (i!=k && j!=k) {
for (int l=0; l<n; l++) {
if (i!=l && j!=l && k!=l) {
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))+to_string(inp.at(l))));
}
}
}
}
}
}
}
}
return set.size();
}
int main() {
int n, k;
cin >> n >> k;
vector<int> inp(n);
for (int i=0; i<n; i++) {
cin >> inp(i);
}
cout << find_num(n, k, &inp) << endl;
} | a.cc: In function 'int find_num(int, int, std::__debug::vector<int>&)':
a.cc:44:15: error: missing template arguments before '.' token
44 | return set.size();
| ^
a.cc: In function 'int main()':
a.cc:52:19: error: no match for call to '(std::__debug::vector<int>) (int&)'
52 | cin >> inp(i);
| ~~~^~~
a.cc:54:28: error: invalid initialization of non-const reference of type 'std::__debug::vector<int>&' from an rvalue of type 'std::__debug::vector<int>*'
54 | cout << find_num(n, k, &inp) << endl;
| ^~~~
a.cc:5:41: note: in passing argument 3 of 'int find_num(int, int, std::__debug::vector<int>&)'
5 | int find_num(int n, int k, vector<int> &inp) {
| ~~~~~~~~~~~~~^~~
|
s438989342 | p03805 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int find_num(int n, int k, vector<int> &inp) {
set<int> num;
if (k=2) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j){
num.insert((int)(stoi(inp.at(i))+to_string(inp.at(j))));
}
}
}
}
else if (k=3) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
for (int k=0; k<n; k++) {
if (i!=j && j!=k && k!=i) {
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))));
}
}
}
}
}
else {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j) {
for (int k=0; k<n; k++) {
if (i!=k && j!=k) {
for (int l=0; l<n; l++) {
if (i!=l && j!=l && k!=l) {
num.insert(stoi(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))+to_string(inp.at(l))));
}
}
}
}
}
}
}
}
return set.size();
}
int main() {
int n, k;
cin >> n >> k;
vector<int> inp(n);
for (int i=0; i<n; i++) {
cin >> inp(i);
}
cout << find_num(n, k, &inp) << endl;
} | a.cc: In function 'int find_num(int, int, std::__debug::vector<int>&)':
a.cc:11:42: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
11 | num.insert((int)(stoi(inp.at(i))+to_string(inp.at(j))));
| ~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:2:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:44:15: error: missing template arguments before '.' token
44 | return set.size();
| ^
a.cc: In function 'int main()':
a.cc:52:19: error: no match for call to '(std::__debug::vector<int>) (int&)'
52 | cin >> inp(i);
| ~~~^~~
a.cc:54:28: error: invalid initialization of non-const reference of type 'std::__debug::vector<int>&' from an rvalue of type 'std::__debug::vector<int>*'
54 | cout << find_num(n, k, &inp) << endl;
| ^~~~
a.cc:5:41: note: in passing argument 3 of 'int find_num(int, int, std::__debug::vector<int>&)'
5 | int find_num(int n, int k, vector<int> &inp) {
| ~~~~~~~~~~~~~^~~
|
s064885025 | p03805 | C++ | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int find_num(int n, int k, vector<int> &inp) {
set<int> num;
if (k=2) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j){
num.insert((int)(to_string(inp.at(i))+to_string(inp.at(j))));
}
}
}
}
else if (k=3) {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
for (int k=0; k<n; k++) {
if (i!=j && j!=k && k!=i) {
num.insert((int)(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))));
}
}
}
}
}
else {
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
if (i!=j) {
for (int k=0; k<n; k++) {
if (i!=k && j!=k) {
for (int l=0; l<n; l++) {
if (i!=l && j!=l && k!=l) {
num.insert((int)(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))+to_string(inp.at(l))));
}
}
}
}
}
}
}
}
return set.size();
}
int main() {
int n, k;
cin >> n >> k;
vector<int> inp(n);
for (int i=0; i<n; i++) {
cin >> inp(i);
}
cout << find_num(n, k, &inp) << endl;
} | a.cc: In function 'int find_num(int, int, std::__debug::vector<int>&)':
a.cc:11:32: error: invalid cast from type 'std::__cxx11::basic_string<char>' to type 'int'
11 | num.insert((int)(to_string(inp.at(i))+to_string(inp.at(j))));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:21:36: error: invalid cast from type 'std::__cxx11::basic_string<char>' to type 'int'
21 | num.insert((int)(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:35:48: error: invalid cast from type 'std::__cxx11::basic_string<char>' to type 'int'
35 | num.insert((int)(to_string(inp.at(i))+to_string(inp.at(j))+to_string(inp.at(k))+to_string(inp.at(l))));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:44:15: error: missing template arguments before '.' token
44 | return set.size();
| ^
a.cc: In function 'int main()':
a.cc:52:19: error: no match for call to '(std::__debug::vector<int>) (int&)'
52 | cin >> inp(i);
| ~~~^~~
a.cc:54:28: error: invalid initialization of non-const reference of type 'std::__debug::vector<int>&' from an rvalue of type 'std::__debug::vector<int>*'
54 | cout << find_num(n, k, &inp) << endl;
| ^~~~
a.cc:5:41: note: in passing argument 3 of 'int find_num(int, int, std::__debug::vector<int>&)'
5 | int find_num(int n, int k, vector<int> &inp) {
| ~~~~~~~~~~~~~^~~
|
s058417225 | p03805 | C++ | #define _DEBUG 1
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z) \
cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
<< endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
void solve(ll N, ll M, std::vector<ll> a, std::vector<ll> b) {
vector<ll> e(N);
for (int i = 0; i < N; i++) {
e.at(i) = i;
}
ll count = 0;
do {
if (e.at(0) == 0) {
bool result = true;
rep(i, N - 1) {
bool found = false;
rep(j, M) {
if ((e.at(i) == a.at(j) && e.at(i + 1) == b.at(j)) ||
(e.at(i + 1) == a.at(j) && e.at(i) == b.at(j))) {
found = true;
break;
}
}
result = result && found;
if (!result)
break;
}
if (result)
count++;
}
} while (next_permutation(all(e)));
ub
cout << count << endl;
}
int main() {
ll N;
scanf("%lld", &N);
ll M;
scanf("%lld", &M);
std::vector<ll> a(M);
std::vector<ll> b(M);
for (int i = 0; i < M; i++) {
scanf("%lld", &a[i]);
scanf("%lld", &b[i]);
a[i]--;
b[i]--;
}
solve(N, M, std::move(a), std::move(b));
return 0;
}
| a.cc: In function 'void solve(ll, ll, std::__debug::vector<long long int>, std::__debug::vector<long long int>)':
a.cc:57:1: error: 'ub' was not declared in this scope; did you mean 'b'?
57 | ub
| ^~
| b
|
s079439774 | p03805 | C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef struct element{
int a,b;
}element;
int path(element *a,int i,int pivot){
}
int main(void){
int numvertex,numedge;
int i,j=0;
int count=0;
int pivot;
int *trait;
element *edge;
scanf("%d %d",&numvertex,&numedge);
edge=(element *)malloc(sizeof(element)*numedge);
trait=(int *)malloc(sizeof(int)*numvertex);
for(i=0;i<numvertex;i++){
trait[i]=0;
}
for(i=0;i<numedge;i++){
scanf("%d %d",&edge[i].a,&edge[i].b);
}
for(i=0;i<numedge;i++){
if(edge[i].a==1){
pivot=edge[i].b;
printf("1%d",pivot);
while(j<numedge){
if(j!=i){
if()
}
}
}
}
return 0;
} | main.c: In function 'main':
main.c:34:24: error: expected expression before ')' token
34 | if()
| ^
|
s284383600 | p03805 | C++ | #include<iostream>
#include<vector>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int per[8];
vector<int> g[8];
int n;
int m;
bool ispath(int x){
if(x == 0){
if(per[x] != 0){
return false;
}
}
// cout << x << endl;
if (x == n - 1){
return true;
}
for (int i = 0; i < g[per[x]].size(); i++){
if (g[per[x]][i] == per[x+1]){
return ispath(x + 1);
}
}
return false;
}
int main(){
cin >> n >> m;
int a, b;
rep(i, m){
cin >> a >> b;
a--; b--;
g[a].push_back(b);
g[b].push_back(a);
}
rep(i, n) per[i] = i;
int ans = 0;
do{
// rep(i, n) cout << per[i];
// cout << endl;
if (ispath(0)){
ans++;
}
}while(next_permutation(per, per + n));
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:49:12: error: 'next_permutation' was not declared in this scope
49 | }while(next_permutation(per, per + n));
| ^~~~~~~~~~~~~~~~
|
s644640745 | p03805 | C++ | #include<iostream>
using namespace std;
int dfs(bool** graph, int v, bool *visited, int N) {
visited[v] = true;
bool visit_a_vertex = false;
bool all_visited = true;
int ret = 0;
for(int i = 0; i < N; i++) {
if(graph[v][i] && !visited[i]) {
visit_a_vertex = true;
ret += dfs(graph,i,visited,N);
}
if(i != v && !visited[i]){
all_visited = false;
}
}
visited[v] = false;
if(!visit_a_vertex && all_visited){
return ret+1;
}
return ret;
}
int main() {
int N,M;
cin >> N >> M;
bool **graph = new bool[N];
bool *visited = new bool[N];
for(int i = 0; i < N; i++) {
graph[i] = new bool[N];
visited[i] = false;
}
for(int i = 0 ; i < M ;i++) {
unsigned s,t;
cin >> s >> t;
graph[s][t] = true;
graph[t][s] = true;
}
for(int i = 0;i < N; i++)
return 0;
} | a.cc: In function 'int main()':
a.cc:33:28: error: cannot convert 'bool*' to 'bool**' in initialization
33 | bool **graph = new bool[N];
| ^
| |
| bool*
|
s135156210 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
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; }
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
inline bool inside(int y, int x, int H, int W) {
return (y >= 0 && x >= 0 && y < H && x < W);
}
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
int G[10][10];
signed main()
{
cin.tie( 0 ); ios::sync_with_stdio( false );
int n,m; cin>>n>>m;
rep(i,m){
int a,b; cin>>a>>b; a--,b--;
G[a][b]=G[b][a]=1;
}
vi g;
for(int i=1; i<n; i++) g.push_back(i);
int ans=0;
do{
bool ok=true;
if(G[0][g[0]]==0) ok=false;
rep(i,n-2) if(G[g[i][i+1]]==0) ok=false;
if(ok) ans++;
}while(next_permutation(all(g)));
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:67:25: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
67 | rep(i,n-2) if(G[g[i][i+1]]==0) ok=false;
| ^
|
s374324902 | p03805 | C++ | #include <iostream>
using namespace std;
vector<vector<bool>> graph(8,vector<bool>(8)) ;
int dfs(int v, int N, bool visit[8]){
bool all_Visit = true; // 変数:全て訪問済
// 全て訪問済か確認
for(int i = 0; i < N; i++){
if(visit[i] == false) all_Visit = false;
}
// 全て訪問のとき1を返して加える
if(all_Visit) return 1;
int ret = 0; // 変数:今回の答えの値リピート
for(int i = 0; i < N; i++){
if(graph[v][i] == false) continue; // 判定:入力時に値が入ってない
if(visit[i]) continue; // ルート自身が存在しない時
visit[i] = true;
ret += dfs(i, N, visit);
visit[i] = false;
}
return ret;
}
int main(void){
int N, M;
cin >> N >> M;
for(int i = 0; i < M; i++){
int A, B;
cin >> A >> B;
A--, B--;
graph[A][B] = graph[B][A] = true;
}
vector<bool> visit(8);
for(int i = 0; i < N; i++){
visit[i] = false;
}
visit[0] = true;
cout << dfs(0, N, visit) << endl;
}
| a.cc:3:1: error: 'vector' does not name a type
3 | vector<vector<bool>> graph(8,vector<bool>(8)) ;
| ^~~~~~
a.cc: In function 'int dfs(int, int, bool*)':
a.cc:22:12: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
22 | if(graph[v][i] == false) continue; // 判定:入力時に値が入ってない
| ^~~~~
| isgraph
a.cc: In function 'int main()':
a.cc:47:9: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
47 | graph[A][B] = graph[B][A] = true;
| ^~~~~
| isgraph
a.cc:50:5: error: 'vector' was not declared in this scope
50 | vector<bool> visit(8);
| ^~~~~~
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:50:12: error: expected primary-expression before 'bool'
50 | vector<bool> visit(8);
| ^~~~
a.cc:52:9: error: 'visit' was not declared in this scope
52 | visit[i] = false;
| ^~~~~
a.cc:2:1: note: 'std::visit' is defined in header '<variant>'; this is probably fixable by adding '#include <variant>'
1 | #include <iostream>
+++ |+#include <variant>
2 | using namespace std;
a.cc:55:5: error: 'visit' was not declared in this scope
55 | visit[0] = true;
| ^~~~~
a.cc:55:5: note: 'std::visit' is defined in header '<variant>'; this is probably fixable by adding '#include <variant>'
|
s301936618 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
int main(){
int N,M;
cin >> N >> M;
vector<int> v;
for(int i = 0; i < N; i++){
v.push_back(i);
}
for(int i = 0; i < M; i++){
int a,b;
cin >> a >> b;
a--;
b--;
G[a].push_back(b);
G[b].push_back(a);
}
int cnt = 0;
do{
for(int i = 0; i < N; i++){
if(i == N - 1) cnt++;
else if(count(G[v[i]].begin(),G[v[i]].end(),v[i + 1]) == 0){
break;
}
}
}while(next_permutation(v.begin()+1,v.end()));
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'G' was not declared in this scope
20 | G[a].push_back(b);
| ^
a.cc:27:21: error: 'G' was not declared in this scope
27 | else if(count(G[v[i]].begin(),G[v[i]].end(),v[i + 1]) == 0){
| ^
|
s150823615 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
int main(){
int N,M;
cin >> N >> M;
vector<int> v;
for(int i = 0; i < N; i++){
v.push_back(i);
}
for(int i = 0; i < M; i++){
int a,b;
cin >> a >> b;
a--;
b--;
G[a].push_back(b);
G[b].push_back(a);
}
int cnt = 0;
do{
for(int i = 0; i < N; i++){
if(i == N - 1) cnt++;
else if(count(G[v[i]].begin(),G[v[i]],end(),v[i + 1]) == 0){
break;
}
}
}while(next_permutation(v.begin()+1,v.end()));
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'G' was not declared in this scope
20 | G[a].push_back(b);
| ^
a.cc:27:21: error: 'G' was not declared in this scope
27 | else if(count(G[v[i]].begin(),G[v[i]],end(),v[i + 1]) == 0){
| ^
a.cc:27:48: error: no matching function for call to 'end()'
27 | else if(count(G[v[i]].begin(),G[v[i]],end(),v[i + 1]) == 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: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: candidate expects 1 argument, 0 provided
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: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: candidate expects 1 argument, 0 provided
/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: candidate expects 1 argument, 0 provided
/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: candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/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: candidate expects 1 argument, 0 provided
/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: candidate expects 1 argument, 0 provided
|
s561700445 | p03805 | C++ | 3
1
2 1
1
1 1
1
2 0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 3
| ^
|
s638623132 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
typedef pair<int,int> P;
int main(){
int n,m;cin>>n>>m;
vector<P> nya(m);
for(int i = 0; m > i; i++){
cin >> nya[i].first>>nya[i].second;
}
vector<int> Pa(n);
for(int i = 0; n > i; i++){
Pa[i] = i+1;
}
int ans = 0;
do{
bool ad = true;
for(int i = 0; n-1 > i; i++){
bool ok = false;
for(int j = 0; m > j; j++){
if(min(nya[j].first,nya[j].second) == min(Pa[i],Pa[i+1]) && max(nya[j].first,nya[j].second) == max(Pa[i],Pa[i+1])){
ok = true;
break;
}
}
if(!ok){
ad = false;
break;
}
}
if(ad)ans++;
}while(next_permutation(Pa.begin(),Pa.end()));
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:32:10: error: 'next_permutation' was not declared in this scope
32 | }while(next_permutation(Pa.begin(),Pa.end()));
| ^~~~~~~~~~~~~~~~
|
s578370818 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
typedef pair<int,int> P;
int main(){
int n,m;cin>>n>>m;
vector<P> nya(m)
for(int i = 0; m > i; i++){
cin >> nya[i].first>>nya[i].second;
}
vector<int> P(n);
for(int i = 0; n > i; i++){
P[i] = i+1;
}
int ans = 0;
do{
bool ad = true;
for(int i = 0; n-1 > i; i++){
bool ok = false;
for(int j = 0; m > j; j++){
if(min(nya[j].first,nya[j].second) == min(P[i],P[i+1]) && max(nya[j].first,nya[j].second) == max(P[i],P[i+1])){
ok = true;
break;
}
}
if(!ok){
ad = false;
break;
}
}
if(ad)ans++;
}while(P.begin(),P.end());
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'for'
8 | for(int i = 0; m > i; i++){
| ^~~
a.cc:8:22: error: 'i' was not declared in this scope
8 | for(int i = 0; m > i; i++){
| ^
a.cc:32:17: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]', declared with attribute 'nodiscard' [-Wunused-result]
32 | }while(P.begin(),P.end());
| ~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:873:7: note: declared here
873 | begin() _GLIBCXX_NOEXCEPT
| ^~~~~
a.cc:32:19: error: could not convert '(((void)P.std::vector<int>::begin()), P.std::vector<int>::end())' from 'std::vector<int>::iterator' to 'bool'
32 | }while(P.begin(),P.end());
| ~~~~~~~~~^~~~~~~~
| |
| std::vector<int>::iterator
|
s574027007 | p03805 | C++ | #include<iostream>
#include<vector>
#include<queue>
#include<string.h>
#include<algorithm>
#include<stack>
#include<set>
#include<numeric>
using namespace std;
int N,M;
int ans=0;
int graph[8][8];
void dfs(int i,int visited[N]);
int main(){
cin>>N>>M;
for (int m = 0; m < M; m++) {
int a;cin>>a;
int b;cin>>b;
graph[a-1][b-1]=graph[b-1][a-1]=1;
}
int visited[N];
for(int n=0;n<N;n++){
visited[n]=0;
}
visited[0]=1;
dfs(0,visited);
cout<<ans<<"\n";
}
void dfs(int i,int visited[N]){
for (int j = 0; j < N; j++) {
if(graph[i][j]==1&&visited[j]==0){
if(accumulate(visited,visited+N,0)==N-1){
ans++;
return;
}
visited[j]=1;
dfs(j,visited);
visited[j]=0;
}
}
} | a.cc:16:28: error: size of array 'visited' is not an integral constant-expression
16 | void dfs(int i,int visited[N]);
| ^
a.cc:35:28: error: size of array 'visited' is not an integral constant-expression
35 | void dfs(int i,int visited[N]){
| ^
|
s553543441 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]
bool belong(vector<int> a,int x){
for(auto y:a){
if(y==x) return true;
}
return false;
}
int main(){
int n,m;cin>>n>>m;
int dai,nyu;
vec2(tree,n,0);
rep(i,m){
cin>>dai>>nyu;
dai --;nyu --;
tree[dai].push_back(nyu);
tree[nyu].push_back(dai);
}
vector<int> x(0);
rep(i,n) x.push_back(i);
sort(all(x));
int cnt =0;
do{
bool flag =true;
if(x.at(0)!=0) break;
rep(i,n-1){
if(!belong(tree[x[i]],x[i+1])){flag=false;break;}
}
if(flag) cnt ++;
}while(next_permutation(all(x)));
cout<<ct<<endl;
}
| a.cc: In function 'int main()':
a.cc:44:7: error: 'ct' was not declared in this scope; did you mean 'cnt'?
44 | cout<<ct<<endl;
| ^~
| cnt
|
s975898529 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
bool check(vector<int> &p,vector<vector<int>> &v)
{
for(int i=0;i<p.size()-1;i++)
if(v[p[i]][p[i+1]]==0)
return false;
return true;
}
int main()
{
int n,m;
cin>>n>>m;
vector<vector<int>> v(n,vector<int>(n,0));
for(int i=0;i<n;i++)
{
int a,b;
cin>>a>>b;
v[a-1][b-1]=1;
v[b-1][a-1]=1;
}
vector<int> p(n);
for(int i=0;i<n;i++)
p[i]=i;
int ans=0;
do
{
if(check(p,v))
ans++;
}while(next_permutation(p.begin(),p.end());
cout<<ans;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:45: error: expected ')' before ';' token
30 | }while(next_permutation(p.begin(),p.end());
| ~ ^
| )
|
s766417275 | p03805 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
ll n,m;
cin>>n>>m;
vll a(m),b(m);
rep(i,m) cin>>a[i]>>b[i];
vll t(n);
rep(i,n){
t[i]=i+1;
}
ll ans=0;
do{
rep(i,n-1){
ll cu=1;
rep(j,m){
if(t[i]==a[j]&&t[i+1]==b[j]){
}
else if(t[i]==b[j]&&t[i+a]==a[j]){
}
else{
cu=0;
break;
}
}
if(cu) ans++;
}
}while(next_permutation(all(t)));
COUT(ans);
} | a.cc: In function 'int main()':
a.cc:56:32: error: no match for 'operator+' (operand types are 'long long int' and 'vll' {aka 'std::vector<long long int>'})
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ~^~
| | |
| | vll {aka std::vector<long long int>}
| long long int
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: 'vll' {aka 'std::vector<long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
1798 | operator+(typename move_iterator<_Iterator>::difference_type __n,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: 'vll' {aka 'std::vector<long long int>'} is not derived from 'const std::move_iterator<_IteratorL>'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
In file included from /usr/include/c++/14/string:54,
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/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3616 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'const _CharT*' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: 'vll' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3719 | operator+(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'const _CharT*' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)'
3726 | operator+(_CharT __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: 'vll' {aka 'std::vector<long long int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)'
3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
/usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)'
3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed:
a.cc:56:33: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'long long int'
56 | else if(t[i]==b[j]&&t[i+a]==a[j]){
| ^
In file included from |
s955025359 | p03805 | Java | import java.util.*;
public class Main {
static int n;
static int count = 0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
List<Integer> nodes = new ArrayList<>();
while(sc.hasNext()) {
nodes.add(sc.nextInt() - 1);
}
n = nodes.size();
LinkedList<Integer>[] graph = new LinkedList[n];
for (int i = 0; i < n ; i+=2) {
graph[i] = new LinkedList<>();
}
for (int i = 0; i < n ; i+=2) {
int node1 = nodes.get(i);
int node2 = nodes.get(i + 1);
graph[node1].add(node2);
graph[node2].add(node1);
}
Set<Integer> visited = new HashSet<>();
helper(graph, 0, visited);
return count;
}
private static void helper(LinkedList<Integer>[] graph, int current, Set<Integer> visited) {
if (visited.size() == n) {
count++;
return;
}
List<Integer> nexts = graph[current];
for (int i =0; i < nexts.size(); i++) {
int next = nexts.get(i);
if(!visited.contains(next)) {
visited.add(next);
helper(graph, next, visited);
}
}
}
}
| Main.java:29: error: incompatible types: unexpected return value
return count;
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s946535486 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
const int nmax=8;
bool graph[nmax][nmax];
bool visited[N]={};
int dsp(int viNodes,int nownode,bool visited[],int N){
visited[nownode]=true;
int ret=0;
for(int i=0;i<N;i++){
if(visited[i])continue;
if(!graph[nownode][i])continue;
if(viNodes==N-1){
visited[nownode]=false;
return 1;
}
ret+=dsp(viNodes+1,i,visited,N);
}
visited[nownode]=false;
return ret;
}
int main(void)
{
int i;
int N,M;
bool visited[nmax]={};
cin>>N>>M;
for(i=0;i<N;i++)visited[i]=false;
for(i=0;i<M;i++){
cin>>i>>j;
graph[i-1][j-1]=true;
graph[j-1][i-1]=true;
}
cout <<dsp(1,0,visited,N)<< endl;
return 0;
}
| a.cc:8:16: error: 'N' was not declared in this scope
8 | bool visited[N]={};
| ^
a.cc: In function 'int main()':
a.cc:40:13: error: 'j' was not declared in this scope
40 | cin>>i>>j;
| ^
|
s032795433 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
const int nmax=8;
bool graph[nmax][nmax];
bool visited[N]={};
bool visited[N]={};
int dsp(int viNodes,int nownode,bool visited[],int N){
visited[nownode]=true;
int ret=0;
for(int i=0;i<N;i++){
if(visited[i])continue;
if(!graph[nownode][i])continue;
if(viNodes==N-1){
visited[nownode]=false;
return 1;
}
ret+=dsp(viNodes+1,i,visited,N);
}
visited[nownode]=false;
return ret;
}
int main(void)
{
int i;
int N,M;
cin>>N>>M;
for(i=0;i<N;i++)visited[i]=false;
for(i=0;i<M;i++){
cin>>i>>j;
graph[i-1][j-1]=true;
graph[j-1][i-1]=true;
}
cout <<dsp(1,0,visited,N)<< endl;
return 0;
}
| a.cc:5:14: error: 'N' was not declared in this scope
5 | bool visited[N]={};
| ^
a.cc:9:16: error: 'N' was not declared in this scope
9 | bool visited[N]={};
| ^
a.cc: In function 'int main()':
a.cc:38:19: error: 'visited' was not declared in this scope
38 | for(i=0;i<N;i++)visited[i]=false;
| ^~~~~~~
a.cc:40:13: error: 'j' was not declared in this scope
40 | cin>>i>>j;
| ^
a.cc:45:18: error: 'visited' was not declared in this scope
45 | cout <<dsp(1,0,visited,N)<< endl;
| ^~~~~~~
|
s641691043 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
bool G[10][10];
int main(){
int N, M; cin >> N >> M;
for(int i=0; i<M; i++){
int a,b; cin >> a >> b; --a, --b;
G[a][b] = G[b][a] = true;
}
vector<int> ord(N);
for(int i=0; i<N; i++){
ord[i] = i;
}
int res = 0;
do{
if(ord[0] != 0) break;
bool ok = true;
for(int i=0; i+1 < N; i++){
int from = ord[i];
int to = ord[i+1];
if(!G[from][to]) ok = false;
}
if(ok) ++res;
}while(next_permutation(ord.begin(), ord.end()));
cout << res << endl;
} | a.cc: In function 'int main()':
a.cc:30:12: error: 'next_permutation' was not declared in this scope
30 | }while(next_permutation(ord.begin(), ord.end()));
| ^~~~~~~~~~~~~~~~
|
s288359094 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
int sum=0;
void dfs(Graph &g,vector<bool> visit,int v){
for(auto nv:g.at(v)){
vector<bool> fin(visit.size(),true);
if(visit==fin){
sum++;
break;
}
if(visit[nv]){
continue;
}
visit[nv]=true;
dfs(g,visit,nv);
}
}
int main(){
int N,M;
Graph g(N);
for(int i=0;i<M;i++){
int a,b;
cin>>a>>b;
G.at(a-1).push_back(b-1);
G.at(b-1).push_back(a-1);
}
vector<bool> visit(N,false);
visit[0]=true;
dfs(g,visit,0);
cout<<sum<<endl;
}
| a.cc: In function 'int main()':
a.cc:28:5: error: 'G' was not declared in this scope
28 | G.at(a-1).push_back(b-1);
| ^
|
s729800246 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
int sum=0;
void dfs(Graph &g,vector<bool> visit,int v){
for(auto nv:g.at(v)){
vector<bool> fin(visit.size(),true)
if(visit==fin){
sum++;
break;
}
if(visit[nv]){
continue;
}
visit[nv]=true;
dfs(g,visit,nv);
}
}
int main(){
int N,M;
Graph g(N);
for(int i=0;i<M;i++){
int a,b;
cin>>a>>b;
G.at(a-1).push_back(b-1);
G.at(b-1).push_back(a-1);
}
vector<bool> visit(N,false);
visit[0]=true;
dfs(g,visit,0);
cout<<sum<<endl;
}
| a.cc: In function 'void dfs(Graph&, std::vector<bool>, int)':
a.cc:10:5: error: expected ',' or ';' before 'if'
10 | if(visit==fin){
| ^~
a.cc: In function 'int main()':
a.cc:28:5: error: 'G' was not declared in this scope
28 | G.at(a-1).push_back(b-1);
| ^
|
s410096998 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
int sum=0;
void dfs(Graph &g,vector<bool> visit,int v){
for(auto nv:g.at(v)){
if(visit==make_vector<bool>(visit.size(),true)){
sum++;
break;
}
if(visit[nv]){
continue;
}
visit[nv]=true;
dfs(g,visit,nv);
}
}
int main(){
int N,M;
Graph g(N);
for(int i=0;i<M;i++){
int a,b;
cin>>a>>b;
G.at(a-1).push_back(b-1);
G.at(b-1).push_back(a-1);
}
vector<bool> visit(N,false);
visit[0]=true;
dfs(g,visit,0);
cout<<sum<<endl;
}
| a.cc: In function 'void dfs(Graph&, std::vector<bool>, int)':
a.cc:9:15: error: 'make_vector' was not declared in this scope
9 | if(visit==make_vector<bool>(visit.size(),true)){
| ^~~~~~~~~~~
a.cc:9:27: error: expected primary-expression before 'bool'
9 | if(visit==make_vector<bool>(visit.size(),true)){
| ^~~~
a.cc:9:27: error: expected ')' before 'bool'
9 | if(visit==make_vector<bool>(visit.size(),true)){
| ~ ^~~~
| )
a.cc: In function 'int main()':
a.cc:27:5: error: 'G' was not declared in this scope
27 | G.at(a-1).push_back(b-1);
| ^
|
s988895434 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
int sum=0;
void dfs(Graph &g,vector<bool> visit,int v){
for(auto nv:g.at(i)){
if(visit==make_vector<bool>(visit.size(),true)){
sum++;
break;
}
if(visit[nv]){
continue;
}
visit[nv]=true;
dfs(g,visit,nv);
}
}
int main(){
int N,M;
Graph g(N);
for(int i=0;i<M;i++){
int a,b;
cin>>a>>b;
G.at(a-1).push_back(b-1);
G.at(b-1).push_back(a-1);
}
vector<bool> visit(N,false);
visit[0]=true;
dfs(g,visit,0);
cout<<sum<<endl;
}
| a.cc: In function 'void dfs(Graph&, std::vector<bool>, int)':
a.cc:8:20: error: 'i' was not declared in this scope
8 | for(auto nv:g.at(i)){
| ^
a.cc:9:15: error: 'make_vector' was not declared in this scope
9 | if(visit==make_vector<bool>(visit.size(),true)){
| ^~~~~~~~~~~
a.cc:9:27: error: expected primary-expression before 'bool'
9 | if(visit==make_vector<bool>(visit.size(),true)){
| ^~~~
a.cc:9:27: error: expected ')' before 'bool'
9 | if(visit==make_vector<bool>(visit.size(),true)){
| ~ ^~~~
| )
a.cc: In function 'int main()':
a.cc:27:5: error: 'G' was not declared in this scope
27 | G.at(a-1).push_back(b-1);
| ^
|
s467153606 | p03805 | C++ | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
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;
}
typedef long long ll;
#define MAX_N 10000
struct Edge {
int to;
int weight;
Edge(int t, int w)
: to(t)
, weight(w)
{
}
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;
vector<int> dx = { 1, 0, -1, 0 };
vector<int> dy = { 0, 1, 0, -1 };
typedef pair<int, int> P;
Graph G;
void dfs(int v, vector<bool>& seen, int& res)
{
bool end = true;
for (int i = 0; i < seen.size(); i++)
if (!seen[i] && i != v) // iにまだ行ってない&&次のvがiではない
end = false;
if (end) {
++res;
return;
}
seen[v] = true;
for (auto nv : G[v]) {
if (seen[nv])
continue;
dfs(nv, seen, res);
}
seen[v] = false;
}
int main()
{
int N, M;
cin >> N >> M;
G.assing(N, vector<int>());
rep(i, M)
{
int a, b;
cin >> a >> b;
a--;
b--;
G[a].push_back(b);
G[b].push_back(a);
}
vector<bool> seen(N, false);
int res = 0;
dfs(0, seen, res);
cout << res << endl;
}
| a.cc: In function 'int main()':
a.cc:74:7: error: 'using Graph = class std::vector<std::vector<int> >' {aka 'class std::vector<std::vector<int> >'} has no member named 'assing'; did you mean 'assign'?
74 | G.assing(N, vector<int>());
| ^~~~~~
| assign
|
s236943754 | p03805 | C++ | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
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;
}
typedef long long ll;
#define MAX_N 10000
struct Edge {
int to;
int weight;
Edge(int t, int w)
: to(t)
, weight(w)
{
}
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;
vector<int> dx = { 1, 0, -1, 0 };
vector<int> dy = { 0, 1, 0, -1 };
typedef pair<int, int> P;
Graph G;
int dfs(int v, vector<bool>& seen, int& res)
{
bool end = true;
for (int i = 0; i < seen.size(); i++;)
if (!seen[i] && i != v) // iにまだ行ってない&&次のvがiではない
end = false;
if (end) {
++res;
return;
}
seen[v] = true;
for (auto nv : G[v]) {
if (seen[nv])
continue;
dfs(nv, seen, res);
}
seen[v] = false;
}
int main()
{
int N, M;
cin >> N >> M;
Graph G(N);
rep(i, M)
{
int a, b;
cin >> a >> b;
a--;
b--;
G[a].push_back(b);
G[b].push_back(a);
}
vector<bool> seen(N, false);
int res = 0;
dfs(0, seen, res);
cout << res << endl;
}
| a.cc: In function 'int dfs(int, std::vector<bool>&, int&)':
a.cc:55:41: error: expected ')' before ';' token
55 | for (int i = 0; i < seen.size(); i++;)
| ~ ^
| )
a.cc:55:42: error: expected primary-expression before ')' token
55 | for (int i = 0; i < seen.size(); i++;)
| ^
a.cc:60:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
60 | return;
| ^~~~~~
a.cc:69:15: warning: control reaches end of non-void function [-Wreturn-type]
69 | seen[v] = false;
| ^~~~~
|
s569552741 | p03805 | C++ | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
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;
}
typedef long long ll;
#define MAX_N 10000
struct Edge {
int to;
int weight;
Edge(int t, int w)
: to(t)
, weight(w)
{
}
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;
vector<int> dx = { 1, 0, -1, 0 };
vector<int> dy = { 0, 1, 0, -1 };
typedef pair<int, int> P;
// DFSを使って全探索
int dfs(int v, vector<bool>& seen, int& res)
{
bool end = true;
for (int i = 0; i < seen.size(); i++;)
if (!seen[i] && i != v) // iにまだ行ってない&&次のvがiではない
end = false;
if (end) {
++res;
return;
}
seen[v] = true;
for (auto nv : G[v]) {
if (seen[nv])
continue;
dfs(nv, seen, res);
}
seen[v] = false;
}
int main()
{
int N, M;
cin >> N >> M;
Graph G(N);
rep(i, M)
{
int a, b;
cin >> a >> b;
a--;
b--;
Graph[a].push_back(b);
Graph[b].push_back(a);
}
vector<bool> seen(N, false);
int res = 0;
dfs(0, seen, res);
cout << res << endl;
}
| a.cc: In function 'int dfs(int, std::vector<bool>&, int&)':
a.cc:55:41: error: expected ')' before ';' token
55 | for (int i = 0; i < seen.size(); i++;)
| ~ ^
| )
a.cc:55:42: error: expected primary-expression before ')' token
55 | for (int i = 0; i < seen.size(); i++;)
| ^
a.cc:60:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
60 | return;
| ^~~~~~
a.cc:64:20: error: 'G' was not declared in this scope
64 | for (auto nv : G[v]) {
| ^
a.cc: In function 'int main()':
a.cc:82:14: error: structured binding declaration cannot have type 'Graph' {aka 'std::vector<std::vector<int> >'}
82 | Graph[a].push_back(b);
| ^~~
a.cc:82:14: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:82:15: error: conflicting declaration 'auto a'
82 | Graph[a].push_back(b);
| ^
a.cc:78:13: note: previous declaration as 'int a'
78 | int a, b;
| ^
a.cc:82:17: error: expected initializer before '.' token
82 | Graph[a].push_back(b);
| ^
a.cc:83:14: error: structured binding declaration cannot have type 'Graph' {aka 'std::vector<std::vector<int> >'}
83 | Graph[b].push_back(a);
| ^~~
a.cc:83:14: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:83:15: error: conflicting declaration 'auto b'
83 | Graph[b].push_back(a);
| ^
a.cc:78:16: note: previous declaration as 'int b'
78 | int a, b;
| ^
a.cc:83:17: error: expected initializer before '.' token
83 | Graph[b].push_back(a);
| ^
a.cc: In function 'int dfs(int, std::vector<bool>&, int&)':
a.cc:69:15: warning: control reaches end of non-void function [-Wreturn-type]
69 | seen[v] = false;
| ^~~~~
|
s649405315 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
using namespace std;
int m,n;
bool G[MAX_N][MAX_N];
bool visited[MAX_N];
int dfs(int u, bool visited2[MAX_N]){
bool flag = true;
for(int i =0; i < n; ++i){
if( !visited2[i] ){
flag = false;
break;
}
}
if(flag) return 1;
int res = 0;
for(int v = 0; i < n; v++){
if( !G[u][v] ) continue;
if( !visited2[v]){
visited2[v] = true;
res += dfs(v, visited2);
visited2[v] = false;
}
}
visited2[u] = true;
return res;
}
int main(){
cin>>n>>m;
for(int i=0;i < n; i++){
int a, b;
cin>>a>>b;
a--;b--;
G[a][b] = G[b][a] = true;
}
visited[0] = true;
int ans = dfs(0,visited);
cout<< ans <<endl;
} | a.cc: In function 'int dfs(int, bool*)':
a.cc:21:20: error: 'i' was not declared in this scope
21 | for(int v = 0; i < n; v++){
| ^
|
s406880417 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
using namespace std;
int m,n;
bool G[MAX_N][MAX_N];
bool visited[MAX_N];
int dfs(int u, bool visited2[MAX_N]){
bool flag = true;
for(int i =0; i < n; ++i){
if( !visited2[i] ){
flag = false;
break;
}
}
if(flag) return 1;
int res = 0;
for(int v = 0; i < n; v++){
if( !G[u][v] ) continue;
if( !visited2[v]){
visited2[v] = true;
res += dfs(v, visited2);
visited2[v] = false;
}
}
visited2[u] = true;
return res;
}
int main(){
cin>>n>>m:
for(int i=0;i < n; i++){
int a, b;
cin>>a>>b;
a--;b--;
G[a][b] = G[b][a] = true;
}
visited[0] = true;
int ans = dfs(0,visited);
cout<< ans <<endl;
} | a.cc: In function 'int dfs(int, bool*)':
a.cc:21:20: error: 'i' was not declared in this scope
21 | for(int v = 0; i < n; v++){
| ^
a.cc: In function 'int main()':
a.cc:34:14: error: expected ';' before ':' token
34 | cin>>n>>m:
| ^
| ;
a.cc:35:17: error: 'i' was not declared in this scope
35 | for(int i=0;i < n; i++){
| ^
|
s796871904 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
using namespace std;
int G[MAX_N][MAX_N];
int n,m;
bool visited[MAX_N];
void dfs(int u, bool visited2[MAX_N]){
bool flag = true;
for(int i = 0; i < n; i++){
if( !visited2[i] ){
flag = false;
break;
}
}
if(flag) return 1;
int res = 0;
for(int v = 0; v < n; v++ ){
if( G[u][v] == 0 )continue;
if( !visited[v] ){
visited2[v] = true;
res += dfs( v, visited2);
visited2[v] = false;
}
}
visited2[u] = true;
return res;
}
int main(){
cin>> n >> m;
for(int i=0; i<m; i++){
int a,b;
cin>>a>>b;
a--;b--;
G[a][b] = G[b][a] = 1;
}
visited[0] = true;
int ans = dfs(0,visited);
cout<< ans <<endl;
} | a.cc: In function 'void dfs(int, bool*)':
a.cc:18:21: error: return-statement with a value, in function returning 'void' [-fpermissive]
18 | if(flag) return 1;
| ^
a.cc:25:23: error: void value not ignored as it ought to be
25 | res += dfs( v, visited2);
| ~~~^~~~~~~~~~~~~~
a.cc:30:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
30 | return res;
| ^~~
a.cc: In function 'int main()':
a.cc:43:18: error: void value not ignored as it ought to be
43 | int ans = dfs(0,visited);
| ~~~^~~~~~~~~~~
|
s704475698 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
bool flag[10];
int N,M;
vector<vector<int>>G;
int rec(int now){
flag[now]=true;
int cnt=0;
for(int i=1;i<=N;i++){
if(!flag[i])break;
cnt++;
}
if(cnt==N)return 1;
int ans=0;
for(auto e:G[now]){
if(!flag[e]){
ans+=rec(G,e);
flag[e]=false;
}
}
return ans;
}
int main(){
cin>>N>>M;
G.resize(N+1);
for(int i=0;i<M;i++){
int a,b;
cin>>a>>b;
G[a].push_back(b);
G[b].push_back(a);
}
cout<<rec(G,1)<<endl;
}
| a.cc: In function 'int rec(int)':
a.cc:17:16: error: cannot convert 'std::vector<std::vector<int> >' to 'int'
17 | ans+=rec(G,e);
| ^
| |
| std::vector<std::vector<int> >
a.cc:6:13: note: initializing argument 1 of 'int rec(int)'
6 | int rec(int now){
| ~~~~^~~
a.cc: In function 'int main()':
a.cc:32:13: error: cannot convert 'std::vector<std::vector<int> >' to 'int'
32 | cout<<rec(G,1)<<endl;
| ^
| |
| std::vector<std::vector<int> >
a.cc:6:13: note: initializing argument 1 of 'int rec(int)'
6 | int rec(int now){
| ~~~~^~~
|
s584142276 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
vector<vector<int>> M[MAX_N][MAX_N];
int n,e;
int dfs_visit(int u,int color2[MAX_N]){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
}
}
if(all_visited) return 1;
int res = 0;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
color2[v] = GRAY;
res += dfs_visit(v,color2);
color2[v] = WHITE;
}
}
color2[u] = BLACK;
return res;
}
int dfs(){
int color[MAX_N];
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
color[u] = GRAY;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
fill(M,MAX_N*MAX_N,0)
for(int i=0;i<e;i++){
int u,v;
cin>>u>>v;
u--;
v--;
M[u][v] =M[v][u]= 1;
}
cout<< dfs() <<endl;
}
| a.cc: In function 'int dfs_visit(int, int*)':
a.cc:24:20: error: no match for 'operator==' (operand types are 'std::vector<std::vector<int> >' and 'int')
24 | if(M[u][v] == 0)continue;
| ~~~~~~~ ^~ ~
| | |
| | int
| std::vector<std::vector<int> >
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::pair<_T1, _T2>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::move_iterator<_IteratorL>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::move_iterator<_IteratorL>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::fpos<_StateT>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::allocator<_CharT>'
24 | if(M[u][v] == 0)continue;
| ^
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from |
s323823950 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
vector<vector<int>> M[MAX_N][MAX_N];
int n,e;
int dfs_visit(int u,int color2[MAX_N]){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
}
}
if(all_visited) return 1;
int res = 0;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
color2[v] = GRAY;
res += dfs_visit(v,color2);
color2[v] = WHITE;
}
}
color2[u] = BLACK;
return res;
}
int dfs(){
int color[MAX_N];
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
color[u] = GRAY;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
for(int i =0;i<n;i++){
for(int j=0;j<n;j++)M[i][j] = 0;
}
for(int i=0;i<e;i++){
int u,v;
cin>>u>>v;
u--;
v--;
M[u][v] =M[v][u]= 1;
}
cout<< dfs() <<endl;
}
| a.cc: In function 'int dfs_visit(int, int*)':
a.cc:24:20: error: no match for 'operator==' (operand types are 'std::vector<std::vector<int> >' and 'int')
24 | if(M[u][v] == 0)continue;
| ~~~~~~~ ^~ ~
| | |
| | int
| std::vector<std::vector<int> >
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::pair<_T1, _T2>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::move_iterator<_IteratorL>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::move_iterator<_IteratorL>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::fpos<_StateT>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from 'const std::allocator<_CharT>'
24 | if(M[u][v] == 0)continue;
| ^
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<std::vector<int> >' is not derived from |
s450217366 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
vector<int> M[MAX_N][MAX_N];
int n,e;
int dfs_visit(int u,int color2[MAX_N]){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
}
}
if(all_visited) return 1;
int res = 0;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
color2[v] = GRAY;
res += dfs_visit(v,color2);
color2[v] = WHITE;
}
}
color2[u] = BLACK;
return res;
}
int dfs(){
int color[MAX_N];
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
color[u] = GRAY;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
for(int i =0;i<n;i++){
for(int j=0;j<n;j++)M[i][j] = 0;
}
for(int i=0;i<e;i++){
int u,v;
cin>>u>>v;
u--;
v--;
M[u][v] =M[v][u]= 1;
}
cout<< dfs() <<endl;
}
| a.cc: In function 'int dfs_visit(int, int*)':
a.cc:24:20: error: no match for 'operator==' (operand types are 'std::vector<int>' and 'int')
24 | if(M[u][v] == 0)continue;
| ~~~~~~~ ^~ ~
| | |
| | int
| std::vector<int>
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::fpos<_StateT>'
24 | if(M[u][v] == 0)continue;
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'const std::allocator<_CharT>'
24 | if(M[u][v] == 0)continue;
| ^
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:629: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> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:24:23: note: 'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
24 | if(M[u][v] == 0)continue;
| ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bo |
s556960583 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
int M[8][8];
int n,e;
int dfs_visit(int u,int color2[MAX_N]){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
break;
}
}
if(all_visited) return 1;
int res = 0;
color2[u] = GRAY;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
res += dfs_visit(v,color2);
color2[u] = WHITE;
}
}
color2[u] = BLACK;
retrn res;
}
int dfs(){
int color[MAX_N];
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
for(int i =0;i<n;i++){
for(int j=0;j<n;j++)M[i][j] = 0;
}
for(int i=0;i<e;i++){
int u,v;
scanf("%d %d",&u,&v);
u--;
v--;
M[u][v] = 1;
}
cout<<dfs()<<endl;
return 0;
}
| a.cc: In function 'int dfs_visit(int, int*)':
a.cc:33:5: error: 'retrn' was not declared in this scope
33 | retrn res;
| ^~~~~
a.cc:32:15: warning: control reaches end of non-void function [-Wreturn-type]
32 | color2[u] = BLACK;
| ^
|
s236909382 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define MAX_N 8
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
int M[8][8];
int n,e;
int dfs_visit(int u,int color2[MAX_N]){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
break;
}
}
if(all_visited) return 1;
int res = 0;
color2[u] = GRAY;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
res += dfs_visit(v);
color2[u] = WHITE;
}
}
color2[u] = BLACK;
retrn res;
}
int dfs(){
int color[MAX_N];
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
for(int i =0;i<n;i++){
for(int j=0;j<n;j++)M[i][j] = 0;
}
for(int i=0;i<e;i++){
int u,v;
scanf("%d %d",&u,&v);
u--;
v--;
M[u][v] = 1;
}
cout<<dfs()<<endl;
return 0;
}
| a.cc: In function 'int dfs_visit(int, int*)':
a.cc:28:29: error: too few arguments to function 'int dfs_visit(int, int*)'
28 | res += dfs_visit(v);
| ~~~~~~~~~^~~
a.cc:13:5: note: declared here
13 | int dfs_visit(int u,int color2[MAX_N]){
| ^~~~~~~~~
a.cc:33:5: error: 'retrn' was not declared in this scope
33 | retrn res;
| ^~~~~
a.cc:32:15: warning: control reaches end of non-void function [-Wreturn-type]
32 | color2[u] = BLACK;
| ^
|
s241299111 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
int M[8][8];
int n,e;
int dfs_visit(int u,int color2[n]){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
break;
}
}
if(all_visited) return 1;
int res = 0;
color2[u] = GRAY;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
res += dfs_visit(v);
color2[u] = WHITE;
}
}
color[u]2 = BLACK;
retrn res;
}
int dfs(){
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
for(int i =0;i<n;i++){
for(int j=0;j<n;j++)M[i][j] = 0;
}
for(int i=0;i<e;i++){
int u,v;
scanf("%d %d",&u,&v);
u--;
v--;
M[u][v] = 1;
}
cout<<dfs()<<endl;
return 0;
}
| a.cc:12:32: error: size of array 'color2' is not an integral constant-expression
12 | int dfs_visit(int u,int color2[n]){
| ^
a.cc: In function 'int dfs_visit(int, int*)':
a.cc:27:29: error: too few arguments to function 'int dfs_visit(int, int*)'
27 | res += dfs_visit(v);
| ~~~~~~~~~^~~
a.cc:12:5: note: declared here
12 | int dfs_visit(int u,int color2[n]){
| ^~~~~~~~~
a.cc:31:5: error: 'color' was not declared in this scope; did you mean 'color2'?
31 | color[u]2 = BLACK;
| ^~~~~
| color2
a.cc:32:5: error: 'retrn' was not declared in this scope
32 | retrn res;
| ^~~~~
a.cc: In function 'int dfs()':
a.cc:36:31: error: 'color' was not declared in this scope
36 | for(int i=0; i < n ; i++) color[i] = WHITE;
| ^~~~~
a.cc:39:28: error: 'color' was not declared in this scope
39 | int ans = dfs_visit(u, color);
| ^~~~~
a.cc: In function 'int dfs_visit(int, int*)':
a.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
33 | }
| ^
|
s737910729 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
int M[8][8];
int n,e;
int dfs_visit(int u,int color2[]){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
break;
}
}
if(all_visited) return 1;
int res = 0;
color2[u] = GRAY;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
res += dfs_visit(v);
colo2[u] = WHITE;
}
}
color[u]2 = BLACK;
retrn res;
}
int dfs(){
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
for(int i =0;i<n;i++){
for(int j=0;j<n;j++)M[i][j] = 0;
}
for(int i=0;i<e;i++){
int u,v;
scanf("%d %d",&u,&v);
u--;
v--;
M[u][v] = 1;
}
cout<<dfs()<<endl;
return 0;
}
| a.cc: In function 'int dfs_visit(int, int*)':
a.cc:27:29: error: too few arguments to function 'int dfs_visit(int, int*)'
27 | res += dfs_visit(v);
| ~~~~~~~~~^~~
a.cc:12:5: note: declared here
12 | int dfs_visit(int u,int color2[]){
| ^~~~~~~~~
a.cc:28:13: error: 'colo2' was not declared in this scope; did you mean 'color2'?
28 | colo2[u] = WHITE;
| ^~~~~
| color2
a.cc:31:5: error: 'color' was not declared in this scope; did you mean 'color2'?
31 | color[u]2 = BLACK;
| ^~~~~
| color2
a.cc:32:5: error: 'retrn' was not declared in this scope
32 | retrn res;
| ^~~~~
a.cc: In function 'int dfs()':
a.cc:36:31: error: 'color' was not declared in this scope
36 | for(int i=0; i < n ; i++) color[i] = WHITE;
| ^~~~~
a.cc:39:28: error: 'color' was not declared in this scope
39 | int ans = dfs_visit(u, color);
| ^~~~~
a.cc: In function 'int dfs_visit(int, int*)':
a.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
33 | }
| ^
|
s927181521 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
int M[8][8];
int dfs_visit(int u,int color2){
bool all_visited = true;
for(int i =0;i<n;i++){
if(color2[i] == WHITE) {
all_visited = false;
break;
}
}
if(all_visited) return 1;
int res = 0;
color2[u] = GRAY;
for(int v = 0; v < n; v++){
if(M[u][v] == 0)continue;
if(color2[v] == WHITE){
res += dfs_visit(v);
colo2[u] = WHITE;
}
}
color[u]2 = BLACK;
retrn res;
}
int dfs(){
for(int i=0; i < n ; i++) color[i] = WHITE;
int u = 0;
int ans = dfs_visit(u, color);
return ans;
}
int main(){
cin>>n>>e;
for(int i =0;i<n;i++){
for(int j=0;j<n;j++)M[i][j] = 0;
}
for(int i=0;i<e;i++){
int u,v;
scanf("%d %d",&u,&v);
u--;
v--;
M[u][v] = 1;
}
cout<<dfs()<<endl;
return 0;
} | a.cc: In function 'int dfs_visit(int, int)':
a.cc:13:20: error: 'n' was not declared in this scope
13 | for(int i =0;i<n;i++){
| ^
a.cc:14:18: error: invalid types 'int[int]' for array subscript
14 | if(color2[i] == WHITE) {
| ^
a.cc:22:11: error: invalid types 'int[int]' for array subscript
22 | color2[u] = GRAY;
| ^
a.cc:23:24: error: 'n' was not declared in this scope
23 | for(int v = 0; v < n; v++){
| ^
a.cc:25:18: error: invalid types 'int[int]' for array subscript
25 | if(color2[v] == WHITE){
| ^
a.cc:26:29: error: too few arguments to function 'int dfs_visit(int, int)'
26 | res += dfs_visit(v);
| ~~~~~~~~~^~~
a.cc:11:5: note: declared here
11 | int dfs_visit(int u,int color2){
| ^~~~~~~~~
a.cc:27:13: error: 'colo2' was not declared in this scope; did you mean 'color2'?
27 | colo2[u] = WHITE;
| ^~~~~
| color2
a.cc:30:5: error: 'color' was not declared in this scope; did you mean 'color2'?
30 | color[u]2 = BLACK;
| ^~~~~
| color2
a.cc:31:5: error: 'retrn' was not declared in this scope
31 | retrn res;
| ^~~~~
a.cc: In function 'int dfs()':
a.cc:35:22: error: 'n' was not declared in this scope
35 | for(int i=0; i < n ; i++) color[i] = WHITE;
| ^
a.cc:35:31: error: 'color' was not declared in this scope
35 | for(int i=0; i < n ; i++) color[i] = WHITE;
| ^~~~~
a.cc:38:28: error: 'color' was not declared in this scope
38 | int ans = dfs_visit(u, color);
| ^~~~~
a.cc: In function 'int main()':
a.cc:43:10: error: 'n' was not declared in this scope; did you mean 'yn'?
43 | cin>>n>>e;
| ^
| yn
a.cc:43:13: error: 'e' was not declared in this scope
43 | cin>>n>>e;
| ^
a.cc: In function 'int dfs_visit(int, int)':
a.cc:32:1: warning: control reaches end of non-void function [-Wreturn-type]
32 | }
| ^
|
s670334501 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<int> G[MAX_V];
int visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int V,E;
int s,t;
int next(int u){
for(int v = nt[u]; v < G[u].size(); v++){
int nt[u] = v;
if( G[u][v] )return v;
}
return -1;
}
int dfs(){
stack<int>st;
st.push(1);
visited[1] = 1;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
if(visited[v] == 0){
st.push(v);
visited[v] = 1;
cnt++;
}
}else{
st.pop();
visited[u] = 2;
cnt--;
}
}
}
int main(){
cin>>V>>E;
for(int i =0; i < E; i++){
cin>>s>> t;
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,1);
fill(visited, visited + V, 0);
dfs();
printf("%d¥n", res);
return 0;
}
| a.cc: In function 'int next(int)':
a.cc:17:21: error: array must be initialized with a brace-enclosed initializer
17 | int nt[u] = v;
| ^
a.cc: In function 'int dfs()':
a.cc:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
45 | }
| ^
|
s765934052 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<int> G[MAX_V];
int visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int V,E;
int s,t;
int next(int u){
for(int v = nt[u]; v < G[u].size(); v++){
int nt[u] = v+1;
if( G[u][v] )return v;
}
return -1;
}
int dfs(){
stack<int>st;
st.push(1);
visited[1] = 1;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
if(visited[v] == 0){
st.push(v);
visited[v] = 1;
cnt++;
}
}else{
st.pop();
visited[u] = 2;
cnt--;
}
}
}
int main(){
cin>>V>>E;
for(int i =0; i < E; i++){
cin>>s>> t;
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,1);
fill(visited, visited + V, 0);
dfs();
printf("%d¥n", res);
return 0;
}
| a.cc: In function 'int next(int)':
a.cc:17:22: error: array must be initialized with a brace-enclosed initializer
17 | int nt[u] = v+1;
| ~^~
a.cc: In function 'int dfs()':
a.cc:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
45 | }
| ^
|
s943868866 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<int> G[MAX_V][MAX_V];
int visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int V,E;
int s,t;
int next(int u){
for(int j = nt[u]; j < G[u].size(); j++){
int v = G[u][j];
if( visited[v] != 1 ){
nt[u] = j;
return v;
}
}
return -1;
}
int dfs(){
stack<int>st;
st.push(1);
visited[1] = 1;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
if(visited[v] != 0)continue;
st.push(v);
visited[v] = 1;
cnt++;
}else{
st.pop();
visited[u] = 2;
cnt--;
}
}
}
int main(){
cin>>V>>E;
for(int i =0; i < E; i++){
cin>>s>> t;
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,1);
fill(visited, visited + V, 0);
dfs();
printf("%d¥n", res);
return 0;
}
| a.cc: In function 'int next(int)':
a.cc:16:34: error: request for member 'size' in 'G[u]', which is of non-class type 'std::vector<int> [8]'
16 | for(int j = nt[u]; j < G[u].size(); j++){
| ^~~~
a.cc:17:23: error: cannot convert 'std::vector<int>' to 'int' in initialization
17 | int v = G[u][j];
| ~~~~~~^
| |
| std::vector<int>
a.cc: In function 'int dfs()':
a.cc:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
47 | }
| ^
a.cc: In function 'int main()':
a.cc:53:14: error: request for member 'push_back' in 'G[s]', which is of non-class type 'std::vector<int> [8]'
53 | G[s].push_back(t);
| ^~~~~~~~~
a.cc:54:14: error: request for member 'push_back' in 'G[t]', which is of non-class type 'std::vector<int> [8]'
54 | G[t].push_back(s);
| ^~~~~~~~~
|
s259028712 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<vector<int>> G[MAX_V][MAX_V];
int visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int V,E;
int s,t;
int next(int u){
for(int j = nt[u]; j < G[u].size(); j++){
int v = G[u][j];
if( visited[v] != 1 ){
nt[u] = j;
return v;
}
}
return -1;
}
int dfs(){
stack<int>st;
st.push(1);
visited[1] = 1;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
if(visited[v] != 0)continue;
st.push(v);
visited[v] = 1;
cnt++;
}else{
st.pop();
visited[u] = 2;
cnt--;
}
}
}
int main(){
cin>>V>>E;
for(int i =0; i < E; i++){
cin>>s>> t;
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,1);
fill(visited, visited + V, 0);
dfs();
printf("%d¥n", res);
return 0;
}
| a.cc: In function 'int next(int)':
a.cc:16:34: error: request for member 'size' in 'G[u]', which is of non-class type 'std::vector<std::vector<int> > [8]'
16 | for(int j = nt[u]; j < G[u].size(); j++){
| ^~~~
a.cc:17:23: error: cannot convert 'std::vector<std::vector<int> >' to 'int' in initialization
17 | int v = G[u][j];
| ~~~~~~^
| |
| std::vector<std::vector<int> >
a.cc: In function 'int dfs()':
a.cc:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
47 | }
| ^
a.cc: In function 'int main()':
a.cc:53:14: error: request for member 'push_back' in 'G[s]', which is of non-class type 'std::vector<std::vector<int> > [8]'
53 | G[s].push_back(t);
| ^~~~~~~~~
a.cc:54:14: error: request for member 'push_back' in 'G[t]', which is of non-class type 'std::vector<std::vector<int> > [8]'
54 | G[t].push_back(s);
| ^~~~~~~~~
|
s748662879 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<vector<<int>> G[MAX_V][MAX_V];
int visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int V,E;
int s,t;
int next(int u){
for(int j = nt[u]; j < G[u].size(); j++){
int v = G[u][j];
if( visited[v] != 1 ){
nt[u] = j;
return v;
}
}
return -1;
}
int dfs(){
stack<int>st;
st.push(1);
visited[1] = 1;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
if(visited[v] != 0)continue;
st.push(v);
visited[v] = 1;
cnt++;
}else{
st.pop();
visited[u] = 2;
cnt--;
}
}
}
int main(){
cin>>V>>E;
for(int i =0; i < E; i++){
cin>>s>> t;
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,1);
fill(visited, visited + V, 0);
dfs();
printf("%d¥n", res);
return 0;
}
| a.cc:7:19: error: template argument 1 is invalid
7 | vector<vector<<int>> G[MAX_V][MAX_V];
| ^~
a.cc:7:19: error: template argument 2 is invalid
a.cc: In function 'int next(int)':
a.cc:16:34: error: request for member 'size' in 'G[u]', which is of non-class type 'int [8]'
16 | for(int j = nt[u]; j < G[u].size(); j++){
| ^~~~
a.cc: In function 'int dfs()':
a.cc:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
47 | }
| ^
a.cc: In function 'int main()':
a.cc:53:14: error: request for member 'push_back' in 'G[s]', which is of non-class type 'int [8]'
53 | G[s].push_back(t);
| ^~~~~~~~~
a.cc:54:14: error: request for member 'push_back' in 'G[t]', which is of non-class type 'int [8]'
54 | G[t].push_back(s);
| ^~~~~~~~~
|
s490884821 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<int> G[ MAX_V ]
vector<int> visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int V,E;
int s,t;
int next(int u){
for(int j = nt[u]; j < G[u].size(); j++){
int v = G[u][j];
if( visited[v] != 1 ){
nt[u] = j;
return v;
}
}
return -1;
}
int dfs(){
stack<int>st;
st.push(1);
visited[1] = 1;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
st.push(v);
visited[v] = 1;
cnt++;
}else{
st.pop();
visited[u] = 2;
cnt--;
}
}
}
int main(){
cin>>V>>E;
for(int i =0; i < E; i++){
cin>>s>> t;
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,1);
fill(visited, visited + V, 0);
dfs();
printf("%d¥n", res);
}
| a.cc:8:1: error: expected initializer before 'vector'
8 | vector<int> visited[ MAX_V ] ;
| ^~~~~~
a.cc: In function 'int next(int)':
a.cc:16:29: error: 'G' was not declared in this scope
16 | for(int j = nt[u]; j < G[u].size(); j++){
| ^
a.cc:18:13: error: 'visited' was not declared in this scope
18 | if( visited[v] != 1 ){
| ^~~~~~~
a.cc: In function 'int dfs()':
a.cc:29:5: error: 'visited' was not declared in this scope
29 | visited[1] = 1;
| ^~~~~~~
a.cc:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
47 | }
| ^
a.cc: In function 'int main()':
a.cc:53:9: error: 'G' was not declared in this scope
53 | G[s].push_back(t);
| ^
a.cc:57:10: error: 'visited' was not declared in this scope
57 | fill(visited, visited + V, 0);
| ^~~~~~~
|
s577593785 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<int> G[ MAX_V ]
int visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int V,E;
int s,t;
int next(int u){
for(int j = nt[u]; j < G[u].size(); j++){
int v = G[u][j];
if( visited[v] != 1 ){
nt[u] = j;
return v;
}
}
return -1;
}
int dfs(){
stack<int>st;
st.push(1);
visited[1] = 1;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
st.push(v);
visited[v] = 1;
cnt++;
}else{
st.pop();
visited[u] = 2;
cnt--;
}
}
}
int main(){
cin>>V>>E;
for(int i =0; i < E; i++){
cin>>s>> t;
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,1);
fill(visited, visited + V, 0);
dfs();
printf("%d¥n", res);
}
| a.cc:8:1: error: expected initializer before 'int'
8 | int visited[ MAX_V ] ;
| ^~~
a.cc: In function 'int next(int)':
a.cc:16:29: error: 'G' was not declared in this scope
16 | for(int j = nt[u]; j < G[u].size(); j++){
| ^
a.cc:18:13: error: 'visited' was not declared in this scope
18 | if( visited[v] != 1 ){
| ^~~~~~~
a.cc: In function 'int dfs()':
a.cc:29:5: error: 'visited' was not declared in this scope
29 | visited[1] = 1;
| ^~~~~~~
a.cc:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
47 | }
| ^
a.cc: In function 'int main()':
a.cc:53:9: error: 'G' was not declared in this scope
53 | G[s].push_back(t);
| ^
a.cc:57:10: error: 'visited' was not declared in this scope
57 | fill(visited, visited + V, 0);
| ^~~~~~~
|
s810989923 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
#define MAX_V 8
vector<int> G[ MAX_V ] ;
bool visited[ MAX_V ] ;
int nt[ MAX_V ] ;
int cnt = 0;
int res = 0;
int next(int u){
for(int j = nt[u]; j < G[u].size(); j++){
int v = G[u][j];
if( !visited[v] ){
nt[u] = j;
return v;
}
}
return -1;
}
int dfs(){
stack<int>st;
st.push(0);
visited[0] = true;
cnt++;
while( !st.empty() ){
if(cnt == V)res++;
int u = st.top();
int v = next(u);
if(v != -1){
st.push(v);
visited[v] = true;
cnt++;
}else{
st.pop();
visited[u] = false;
cnt--;
}
}
}
int main(){
int V,E;
cin>>V>>E;
for(int i =0; i < E; i++){
int s,t;
scanf("%d %d", &s, &t);
G[s].push_back(t);
G[t].push_back(s);
}
fill(nt,nt + V,0);
fill(visited, visited + V, false);
dfs();
printf("%d¥n", res);
}
| a.cc: In function 'int dfs()':
a.cc:31:19: error: 'V' was not declared in this scope
31 | if(cnt == V)res++;
| ^
a.cc:44:1: warning: no return statement in function returning non-void [-Wreturn-type]
44 | }
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.