submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s036066766 | 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;
scanf("%d %d", 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 | }
| ^
|
s194547623 | 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;
scanf("%d %d", &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 | }
| ^
|
s054301174 | 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;
scanf("%d %d", &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();
pr#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;
scanf("%d %d", &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);
}
intf("%d¥n", res);
}
| a.cc:58:7: error: stray '#' in program
58 | pr#include <bits/stdc++.h>
| ^
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 | }
| ^
a.cc: In function 'int main()':
a.cc:58:5: error: 'pr' was not declared in this scope
58 | pr#include <bits/stdc++.h>
| ^~
a.cc:70:16: error: a function-definition is not allowed here before '{' token
70 | int next(int u){
| ^
a.cc:81:8: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
81 | int dfs(){
| ^~
a.cc:81:8: note: remove parentheses to default-initialize a variable
81 | int dfs(){
| ^~
| --
a.cc:81:8: note: or replace parentheses with braces to value-initialize a variable
a.cc:81:10: error: a function-definition is not allowed here before '{' token
81 | int dfs(){
| ^
a.cc:103:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
103 | int main(){
| ^~
a.cc:103:9: note: remove parentheses to default-initialize a variable
103 | int main(){
| ^~
| --
a.cc:103:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:103:11: error: a function-definition is not allowed here before '{' token
103 | int main(){
| ^
a.cc:117:1: error: 'intf' was not declared in this scope; did you mean 'rintf'?
117 | intf("%d¥n", res);
| ^~~~
| rintf
|
s741553611 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
constant int 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;
scanf("%d %d", &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:5:1: error: 'constant' does not name a type; did you mean 'const'?
5 | constant int MAX_V = 8;
| ^~~~~~~~
| const
a.cc:7:16: error: 'MAX_V' was not declared in this scope
7 | vector<int> G[ MAX_V ] ;
| ^~~~~
a.cc:8:15: error: 'MAX_V' was not declared in this scope
8 | bool visited[ MAX_V ] ;
| ^~~~~
a.cc:9:9: error: 'MAX_V' was not declared in this scope
9 | int nt[ MAX_V ] ;
| ^~~~~
a.cc: In function 'int next(int)':
a.cc:14:17: error: 'nt' was not declared in this scope; did you mean 'int'?
14 | for(int j = nt[u]; j < G[u].size(); j++){
| ^~
| int
a.cc:14:29: error: 'G' was not declared in this scope
14 | for(int j = nt[u]; j < G[u].size(); j++){
| ^
a.cc:16:14: error: 'visited' was not declared in this scope
16 | if( !visited[v] ){
| ^~~~~~~
a.cc: In function 'int dfs()':
a.cc:27:5: error: 'visited' was not declared in this scope
27 | visited[0] = true;
| ^~~~~~~
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 | }
| ^
a.cc: In function 'int main()':
a.cc:52:9: error: 'G' was not declared in this scope
52 | G[s].push_back(t);
| ^
a.cc:55:10: error: 'nt' was not declared in this scope; did you mean 'int'?
55 | fill(nt,nt + V,0);
| ^~
| int
a.cc:56:10: error: 'visited' was not declared in this scope
56 | fill(visited, visited + V, false);
| ^~~~~~~
|
s396073375 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int 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;
scanf("%d %d", &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:7:16: error: size of array 'G' is not an integral constant-expression
7 | vector<int> G[ MAX_V ] ;
| ^~~~~
a.cc:8:15: error: size of array 'visited' is not an integral constant-expression
8 | bool visited[ MAX_V ] ;
| ^~~~~
a.cc:9:9: error: size of array 'nt' is not an integral constant-expression
9 | int nt[ MAX_V ] ;
| ^~~~~
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 | }
| ^
|
s515964708 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int 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;
scanf("%d %d", &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:7:15: error: size of array 'G' is not an integral constant-expression
7 | vector<int> G[MAX_V];
| ^~~~~
a.cc:8:14: error: size of array 'visited' is not an integral constant-expression
8 | bool visited[MAX_V];
| ^~~~~
a.cc:9:8: error: size of array 'nt' is not an integral constant-expression
9 | int nt[MAX_V];
| ^~~~~
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 | }
| ^
|
s821475981 | p03805 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
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;
scanf("%d %d", &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:5:15: error: 'MAX_V' was not declared in this scope
5 | vector<int> G[MAX_V];
| ^~~~~
a.cc:6:14: error: 'MAX_V' was not declared in this scope
6 | bool visited[MAX_V];
| ^~~~~
a.cc:7:8: error: 'MAX_V' was not declared in this scope
7 | int nt[MAX_V];
| ^~~~~
a.cc: In function 'int next(int)':
a.cc:12:17: error: 'nt' was not declared in this scope; did you mean 'int'?
12 | for(int j = nt[u]; j < G[u].size(); j++){
| ^~
| int
a.cc:12:29: error: 'G' was not declared in this scope
12 | for(int j = nt[u]; j < G[u].size(); j++){
| ^
a.cc:14:14: error: 'visited' was not declared in this scope
14 | if( !visited[v] ){
| ^~~~~~~
a.cc: In function 'int dfs()':
a.cc:25:5: error: 'visited' was not declared in this scope
25 | visited[0] = true;
| ^~~~~~~
a.cc:29:19: error: 'V' was not declared in this scope
29 | if(cnt == V)res++;
| ^
a.cc:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
42 | }
| ^
a.cc: In function 'int main()':
a.cc:50:9: error: 'G' was not declared in this scope
50 | G[s].push_back(t);
| ^
a.cc:53:10: error: 'nt' was not declared in this scope; did you mean 'int'?
53 | fill(nt,nt + V,0);
| ^~
| int
a.cc:54:10: error: 'visited' was not declared in this scope
54 | fill(visited, visited + V, false);
| ^~~~~~~
|
s023175107 | p03805 | C++ | /*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (ll i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
ll Len(ll n) {
ll s=0;
while(n!=0) s++, n/=10;
return s;
}
ll Sint(ll n) {
ll m=0,s=0,a=n;
while(a!=0) s++, a/=10;
for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
return m;
}
ll Svec(vector<ll> v){
ll n=0;
for(ll i=0;i<v.size();i++) n+=v[i];
return n;
}
ll GCD(ll a,ll b) {
return b ? GCD(b,a%b) : a;
}
ll LCM(ll a,ll b){
return a/GCD(a,b)*b;
}
ll Factorial(ll n){
ll m=1;
while(n>=1) m*=n,n--;
return m;
}
vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
ll x=1;
if(s.size()==1){
p.push_back(pair<char,ll>(s[0],1));
return p;
}
for(ll i=0;i<s.size()-1;i++){
if(s[i]==s[i+1]){
x++;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[i],x));
}
}else{
p.push_back(pair<char,ll>(s[i],x));
x=1;
if(i==s.size()-2){
p.push_back(pair<char,ll>(s[s.size()-1],x));
}
}
}
return p;
}
ll COM(ll n,ll k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
vector<bool> isPrime(MAX_N+1,true);
for(int i=2;i<=MAX_N;i++){
if(isPrime[i]){
for(int j=2*i;j<=MAX_N;j+=i){
isPrime[j]=false;
}
}
}
return isPrime;
}
vector<vector<ll>> G;
void dfs(ll v,vector<bool> &reached,ll &ans){
bool isEnd=true;
rep(i,reached.size()) if(!(reached[i]) && i!=v) isEnd=false;
if(isEnd){
ans++;
return;
}
reached[v]=true;
for(auto nv:G[v]){
if(reached[nv]) continue;
dfs(nv,reached,ans);
}
reached[v]=false;
}
/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
IOS;
ll n,m,ans=0;
cin>>n>>m;
vector<bool> reached(n,false);
G.assign(n,vector<int>());
rep(i,m){
ll a,b;cin>>a>>b;
G[a-1].push_back(b-1);
G[b-1].push_back(a-1);
}
dfs(0,reached,ans);
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:145:11: error: no matching function for call to 'std::vector<std::vector<long long int> >::assign(ll&, std::vector<int>)'
145 | G.assign(n,vector<int>());
| ~~~~~~~~^~~~~~~~~~~~~~~~~
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:2:
/usr/include/c++/14/bits/stl_vector.h:828:9: note: candidate: 'template<class _InputIterator, class> void std::vector<_Tp, _Alloc>::assign(_InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
828 | assign(_InputIterator __first, _InputIterator __last)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:828:9: note: template argument deduction/substitution failed:
a.cc:145:11: note: deduced conflicting types for parameter '_InputIterator' ('long long int' and 'std::vector<int>')
145 | G.assign(n,vector<int>());
| ~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:808:7: note: candidate: 'void std::vector<_Tp, _Alloc>::assign(size_type, const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; size_type = long unsigned int; value_type = std::vector<long long int>]'
808 | assign(size_type __n, const value_type& __val)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:808:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<std::vector<long long int> >::value_type&' {aka 'const std::vector<long long int>&'}
808 | assign(size_type __n, const value_type& __val)
| ~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_vector.h:855:7: note: candidate: 'void std::vector<_Tp, _Alloc>::assign(std::initializer_list<_Tp>) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
855 | assign(initializer_list<value_type> __l)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:855:7: note: candidate expects 1 argument, 2 provided
|
s196368221 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
const int max = 8;
bool g[max][max];
int dfs(int k, int n, bool vis[])
{
bool check = true;
for(int i = 0; i < n; i++)
if(vis[i] == false)
check = false;
if(check)
return 1;
int res = 0;
for(int i = 0; i < n; i++)
{
if(g[k][i] == false)
continue;
if(vis[i])
continue;
vis[i] = true;
res += dfs(i, n, vis);
vis[i] = false;
}
return res;
}
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 vis[n];
memset(vis, false, sizeof(vis));
cout<<dfs(0, n, vis)<<"\n";
}
| a.cc:5:8: error: reference to 'max' is ambiguous
5 | bool g[max][max];
| ^~~
In file included 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/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:4:11: note: 'const int max'
4 | const int max = 8;
| ^~~
a.cc:5:13: error: reference to 'max' is ambiguous
5 | bool g[max][max];
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:4:11: note: 'const int max'
4 | const int max = 8;
| ^~~
a.cc: In function 'int dfs(int, int, bool*)':
a.cc:18:12: error: 'g' was not declared in this scope
18 | if(g[k][i] == false)
| ^
a.cc: In function 'int main()':
a.cc:37:9: error: 'g' was not declared in this scope
37 | g[a-1][b-1] = g[b-1][a-1] = true;
| ^
|
s099762987 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,m,a,b,ans;
vector<int> path[10];
bool reached[10];
void dfs(int x){
reached[x] = true;
int c = 0;
for(int i=0;i<n;++i)
if(reached[i]) c++;
if(c==n){
ans++;
return;
}
for(auto &i:path[x]){
if(reaced[i]) continue;
dfs(i);
reached[i] = false;
}
}
int main()
{
cin >> n >> m;
for(int i=0; i<m; i++){
cin >> a >> b;
a--;
b--;
path[a].push_back(b);
path[b].push_back(a);
}
ans = 0;
for(int i=0;i<n;++i) reached[i]=false;
dfs(0);
cout << ans << "\n";
}
| a.cc: In function 'void dfs(int)':
a.cc:16:8: error: 'reaced' was not declared in this scope; did you mean 'reached'?
16 | if(reaced[i]) continue;
| ^~~~~~
| reached
|
s824849255 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,m,a,b,ans;
bool reached[10];
void dfs(int x){
reached[x] = true;
int c = 0;
for(int i=0;i<n;++i)
if(reached[i]) c++;
if(c==n){
ans++;
return;
}
for(auto &i:path[x]){
if(reaced[i]) continue;
dfs(i);
reached[i] = false;
}
}
int main()
{
cin >> n >> m;
vector<vector<int>> path[n];
for(int i=0; i<m; i++){
cin >> a >> b;
a--;
b--;
path[a].push_back(b);
path[b].push_back(a);
}
ans = 0;
for(int i=0;i<n;++i) reached[i]=false;
dfs(0);
cout << ans << "\n";
}
| a.cc: In function 'void dfs(int)':
a.cc:14:15: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
14 | for(auto &i:path[x]){
| ^~~~
| std::filesystem::__cxx11::path
In file included from /usr/include/c++/14/filesystem:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
from a.cc:1:
/usr/include/c++/14/bits/fs_path.h:293:9: note: 'std::filesystem::__cxx11::path' declared here
293 | class path
| ^~~~
a.cc:15:8: error: 'reaced' was not declared in this scope; did you mean 'reached'?
15 | if(reaced[i]) continue;
| ^~~~~~
| reached
a.cc: In function 'int main()':
a.cc:29:22: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
29 | path[a].push_back(b);
| ~~~~~~~~~~~~~~~~~^~~
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:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:30:22: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
30 | path[b].push_back(a);
| ~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
|
s888568021 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,m,a,b,ans;
bool reaced[10];
void dfs(int x){
reached[x] = true;
int c = 0;
for(int i=0;i<n;++i)
if(reached[i]) c++;
if(c==n){
ans++;
return;
}
for(auto &i:path[x]){
if(reaced[i]) continue;
dfs(i);
reached[i] = false;
}
}
int main()
{
cin >> n >> m;
vector<vector<int>> path[n];
for(int i=0; i<m; i++){
cin >> a >> b;
a--;
b--;
path[a].push_back(b);
path[b].push_back(a);
}
ans = 0;
for(int i=0;i<n;++i) reached[i]=false;
dfs(0);
cout << ans << "\n";
}
| a.cc: In function 'void dfs(int)':
a.cc:6:3: error: 'reached' was not declared in this scope; did you mean 'reaced'?
6 | reached[x] = true;
| ^~~~~~~
| reaced
a.cc:14:15: error: 'path' was not declared in this scope; did you mean 'std::filesystem::__cxx11::path'?
14 | for(auto &i:path[x]){
| ^~~~
| std::filesystem::__cxx11::path
In file included from /usr/include/c++/14/filesystem:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
from a.cc:1:
/usr/include/c++/14/bits/fs_path.h:293:9: note: 'std::filesystem::__cxx11::path' declared here
293 | class path
| ^~~~
a.cc: In function 'int main()':
a.cc:29:22: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
29 | path[a].push_back(b);
| ~~~~~~~~~~~~~~~~~^~~
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:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:30:22: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
30 | path[b].push_back(a);
| ~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:34:24: error: 'reached' was not declared in this scope; did you mean 'reaced'?
34 | for(int i=0;i<n;++i) reached[i]=false;
| ^~~~~~~
| reaced
|
s636954873 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,m,a,b,ans;
bool reaced[10];
void dfs(x){
reached[x] = true;
int c = 0;
for(int i=0;i<n;++i)
if(reached[i]) c++;
if(c==n){
ans++;
return;
}
for(auto &i:path[x]){
if(reaced[i]) continue;
dfs(i);
reached[i] = false;
}
ans = 0;
for(int i=0;i<n;++i) reached[i]=false;
dfs(0);
cout << ans << "\n";
}
int main()
{
cin >> n >> m;
vector<vector<int>> path[n];
for(int i=0; i<m; i++){
cin >> a >> b;
a--;
b--;
path[a].push_back(b);
path[b].push_back(a);
}
} | a.cc:5:6: error: variable or field 'dfs' declared void
5 | void dfs(x){
| ^~~
a.cc:5:10: error: 'x' was not declared in this scope
5 | void dfs(x){
| ^
a.cc: In function 'int main()':
a.cc:33:22: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
33 | path[a].push_back(b);
| ~~~~~~~~~~~~~~~~~^~~
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:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:34:22: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(int&)'
34 | path[b].push_back(a);
| ~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
1283 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
1300 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
|
s840311267 | p03805 | C++ | #include<iostream>
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;
}
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]=fasle;
visited[0]=true;
cout<<dfs(0,N,visited)<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:33:40: error: 'fasle' was not declared in this scope
33 | for(int i=0;i<N;i++)visited[i]=fasle;
| ^~~~~
|
s771908278 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
int n,m;
cin >> n >> m;
vector<vector<bool>> g[10][10];
for(int i=0;i<m;i++){
int from,to;
cin >> from >> to;
from--;
to--;
g[from][to]=true;
g[to][from]=true;
}
vector<int> p(n);
for(int i=0;i<n;i++){
p[i]=i;
}
int ans=0;
do{
bool flag=true;
for(int i=0;i<n-1;i++){
if(!g[p[i]][p[i+1]]){
flag=false;
break;
}
}
if(flag) ans++;
}while(next_permutation(p.begin(),p.end()));
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:15:17: error: no match for 'operator=' (operand types are 'std::vector<std::vector<bool> >' and 'bool')
15 | g[from][to]=true;
| ^~~~
In file included from /usr/include/c++/14/vector:72,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'bool' to 'const std::vector<std::vector<bool> >&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'bool' to 'std::vector<std::vector<bool> >&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'bool' to 'std::initializer_list<std::vector<bool> >'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:16:17: error: no match for 'operator=' (operand types are 'std::vector<std::vector<bool> >' and 'bool')
16 | g[to][from]=true;
| ^~~~
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'bool' to 'const std::vector<std::vector<bool> >&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'bool' to 'std::vector<std::vector<bool> >&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<bool>; _Alloc = std::allocator<std::vector<bool> >]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'bool' to 'std::initializer_list<std::vector<bool> >'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:26:10: error: no match for 'operator!' (operand type is 'std::vector<std::vector<bool> >')
26 | if(!g[p[i]][p[i+1]]){
| ^~~~~~~~~~~~~~~~
a.cc:26:10: note: candidate: 'operator!(bool)' (built-in)
a.cc:26:10: note: no known conversion for argument 1 from 'std::vector<std::vector<bool> >' to 'bool'
|
s923515708 | p03805 | C++ | int main() {
int n, m;
cin >> n >> m;
vector<vector<bool>> check(n, vector<bool>(m, false));
for (int i = 0; i < m; i++) {
int a, b; cin >> a >> b; a--; b--;
check[a][b] = check[b][a] = true;
}
vector<int> ord(n);
for (int i = 0; i < n; i++) {
ord[i] = i;
}
int ans = 0;
do {
if (ord[0] != 0) break;
bool ok = false;
for (int i = 0; i < n - 1; i++) {
int from = ord[i];
int to = ord[i+1];
if(check[from][to]) ok = true;
}
if(ok) ans++;
} while (next_permutation(ord.begin(), ord.end()));
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
3 | cin >> n >> m;
| ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
5 | vector<vector<bool>> check(n, vector<bool>(m, false));
| ^~~~~~
a.cc:5:17: error: expected primary-expression before 'bool'
5 | vector<vector<bool>> check(n, vector<bool>(m, false));
| ^~~~
a.cc:8:5: error: 'check' was not declared in this scope
8 | check[a][b] = check[b][a] = true;
| ^~~~~
a.cc:11:10: error: expected primary-expression before 'int'
11 | vector<int> ord(n);
| ^~~
a.cc:13:5: error: 'ord' was not declared in this scope
13 | ord[i] = i;
| ^~~
a.cc:18:9: error: 'ord' was not declared in this scope
18 | if (ord[0] != 0) break;
| ^~~
a.cc:22:18: error: 'ord' was not declared in this scope
22 | int from = ord[i];
| ^~~
a.cc:24:10: error: 'check' was not declared in this scope
24 | if(check[from][to]) ok = true;
| ^~~~~
a.cc:27:29: error: 'ord' was not declared in this scope
27 | } while (next_permutation(ord.begin(), ord.end()));
| ^~~
a.cc:27:12: error: 'next_permutation' was not declared in this scope
27 | } while (next_permutation(ord.begin(), ord.end()));
| ^~~~~~~~~~~~~~~~
a.cc:28:3: error: 'cout' was not declared in this scope
28 | cout << ans << endl;
| ^~~~
a.cc:28:18: error: 'endl' was not declared in this scope
28 | cout << ans << endl;
| ^~~~
|
s623072197 | p03805 | C++ | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
using Graph = vector<vector<int>>;
int ans=0;
int N,M;
// 深さ優先探索
void dfs(const Graph &G, int v,vector<int> seen) {
seen[v] = 1; // v を訪問済にする
if(accumulate(seen.begin(),seen.end(),0)==N)ans++;
// v から行ける各頂点 next_v について
for (auto next_v : G[v]) {
if (seen[next_v]) continue; // next_v が探索済だったらスルー
dfs(G, next_v, vector<bool> seen); // 再帰的に探索
}
}
int main() {
// 頂点数と辺数
cin >> N >> M;
// グラフ入力受取 (ここでは無向グラフを想定)
Graph G(N);
for (int i = 0; i < M; ++i) {
int a, b;
cin >> a >> b;
G[a].push_back(b);
G[b].push_back(a);
}
// 頂点 0 をスタートとした探索
vector<int> seen;
seen.assign(N, 0); // 全頂点を「未訪問」に初期化
dfs(G, 0, seen);
} | a.cc: In function 'void dfs(const Graph&, int, std::vector<int>)':
a.cc:16:37: error: expected primary-expression before 'seen'
16 | dfs(G, next_v, vector<bool> seen); // 再帰的に探索
| ^~~~
|
s544903534 | p03805 | C++ | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
using Graph = vector<vector<int>>;
int ans=0;
int N,M;
// 深さ優先探索
void dfs(const Graph &G, int v,vector<int> seen) {
seen[v] = 1; // v を訪問済にする
if(accumulate(seen.begin(),seen.end(),0)==N)ans++;
// v から行ける各頂点 next_v について
for (auto next_v : G[v]) {
if (seen[next_v]) continue; // next_v が探索済だったらスルー
dfs(G, next_v, vector<bool> seen); // 再帰的に探索
}
}
int main() {
// 頂点数と辺数
cin >> N >> M;
// グラフ入力受取 (ここでは無向グラフを想定)
Graph G(N);
for (int i = 0; i < M; ++i) {
int a, b;
cin >> a >> b;
G[a].push_back(b);
G[b].push_back(a);
}
// 頂点 0 をスタートとした探索
seen.assign(N, 0); // 全頂点を「未訪問」に初期化
dfs(G, 0, seen);
} | a.cc: In function 'void dfs(const Graph&, int, std::vector<int>)':
a.cc:16:37: error: expected primary-expression before 'seen'
16 | dfs(G, next_v, vector<bool> seen); // 再帰的に探索
| ^~~~
a.cc: In function 'int main()':
a.cc:34:5: error: 'seen' was not declared in this scope
34 | seen.assign(N, 0); // 全頂点を「未訪問」に初期化
| ^~~~
|
s076937794 | p03805 | C++ | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
using Graph = vector<vector<int>>;
int ans=0;
// 深さ優先探索
void dfs(const Graph &G, int v,vector<int> seen) {
seen[v] = 1; // v を訪問済にする
if(accumulate(seen.begin(),seen.end(),0)==N)ans++;
// v から行ける各頂点 next_v について
for (auto next_v : G[v]) {
if (seen[next_v]) continue; // next_v が探索済だったらスルー
dfs(G, next_v, vector<bool> seen); // 再帰的に探索
}
}
int main() {
// 頂点数と辺数
int N, M; cin >> N >> M;
// グラフ入力受取 (ここでは無向グラフを想定)
Graph G(N);
for (int i = 0; i < M; ++i) {
int a, b;
cin >> a >> b;
G[a].push_back(b);
G[b].push_back(a);
}
// 頂点 0 をスタートとした探索
seen.assign(N, 0); // 全頂点を「未訪問」に初期化
dfs(G, 0, seen);
} | a.cc: In function 'void dfs(const Graph&, int, std::vector<int>)':
a.cc:11:47: error: 'N' was not declared in this scope
11 | if(accumulate(seen.begin(),seen.end(),0)==N)ans++;
| ^
a.cc:15:37: error: expected primary-expression before 'seen'
15 | dfs(G, next_v, vector<bool> seen); // 再帰的に探索
| ^~~~
a.cc: In function 'int main()':
a.cc:33:5: error: 'seen' was not declared in this scope
33 | seen.assign(N, 0); // 全頂点を「未訪問」に初期化
| ^~~~
|
s843098770 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;
int ans=0;
// 深さ優先探索
void dfs(const Graph &G, int v,vector<int> seen) {
seen[v] = 1; // v を訪問済にする
if(accumulate(seen.begin(),seen.end(),0)==N)ans++;
// v から行ける各頂点 next_v について
for (auto next_v : G[v]) {
if (seen[next_v]) continue; // next_v が探索済だったらスルー
dfs(G, next_v, vector<bool> seen); // 再帰的に探索
}
}
int main() {
// 頂点数と辺数
int N, M; cin >> N >> M;
// グラフ入力受取 (ここでは無向グラフを想定)
Graph G(N);
for (int i = 0; i < M; ++i) {
int a, b;
cin >> a >> b;
G[a].push_back(b);
G[b].push_back(a);
}
// 頂点 0 をスタートとした探索
seen.assign(N, 0); // 全頂点を「未訪問」に初期化
dfs(G, 0, seen);
} | a.cc: In function 'void dfs(const Graph&, int, std::vector<int>)':
a.cc:10:8: error: 'accumulate' was not declared in this scope
10 | if(accumulate(seen.begin(),seen.end(),0)==N)ans++;
| ^~~~~~~~~~
a.cc:10:47: error: 'N' was not declared in this scope
10 | if(accumulate(seen.begin(),seen.end(),0)==N)ans++;
| ^
a.cc:14:37: error: expected primary-expression before 'seen'
14 | dfs(G, next_v, vector<bool> seen); // 再帰的に探索
| ^~~~
a.cc: In function 'int main()':
a.cc:32:5: error: 'seen' was not declared in this scope
32 | seen.assign(N, 0); // 全頂点を「未訪問」に初期化
| ^~~~
|
s939125015 | p03805 | Java | import java.util.*;
public class Main {
static int[][] dp;
static Node[] v;
static ArrayList<Integer> edges[];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next()), M = Integer.parseInt(sc.next());
edges=new ArrayList[N];
for(int i=0;i<N;i++) edges[i] = new ArrayList<>();
for(int i=0;i<M;i++) {
int a = Integer.parseInt(sc.next())-1, b = Integer.parseInt(sc.next())-1;
edges[a].add(b);
edges[b].add(a);
}
dp = new int[1<<N][N];
for(int i =0;i<(1<<N);i++) for(int j=0;j<N;j++) dp[i][j] = -1;
System.out.println(dp(1,0));
}
public static int dp(int i,int j) {
if(i==0) return dp[i][j] = 1;
if(dp[i][j] >= 0) return dp[i][j];
dp[i][j]=0;
for(int id : edges[j]) if((i & (1<<id)) != 0) dp[i][j]+= dp(i-(1<<id),id);
return dp[i][j];
}
} | Main.java:5: error: cannot find symbol
static Node[] v;
^
symbol: class Node
location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s653308137 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
//入力を受け取る
int N ;
cin >> N ;
int M ;
cin >> M;
vector<int> S;
for(int i=0;i < 2M;i++){
cin >> S.at(i)
}
//テストコード
for(int j=0;j<M; j++){
cout << S.at(2j);
cout << S.at(2j+1) << endl;
}
} | a.cc: In function 'int main()':
a.cc:15:17: error: unable to find numeric literal operator 'operator""M'
15 | for(int i=0;i < 2M;i++){
| ^~
a.cc:16:19: error: expected ';' before '}' token
16 | cin >> S.at(i)
| ^
| ;
17 | }
| ~
a.cc:21:17: error: no matching function for call to 'std::vector<int>::at(__complex__ int)'
21 | cout << S.at(2j);
| ~~~~^~~~
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:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
1180 | at(size_type __n)
| ^~
/usr/include/c++/14/bits/stl_vector.h:1180:20: note: no known conversion for argument 1 from '__complex__ int' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1180 | at(size_type __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
1199 | at(size_type __n) const
| ^~
/usr/include/c++/14/bits/stl_vector.h:1199:20: note: no known conversion for argument 1 from '__complex__ int' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1199 | at(size_type __n) const
| ~~~~~~~~~~^~~
a.cc:22:17: error: no matching function for call to 'std::vector<int>::at(__complex__ int)'
22 | cout << S.at(2j+1) << endl;
| ~~~~^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
1180 | at(size_type __n)
| ^~
/usr/include/c++/14/bits/stl_vector.h:1180:20: note: no known conversion for argument 1 from '__complex__ int' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1180 | at(size_type __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
1199 | at(size_type __n) const
| ^~
/usr/include/c++/14/bits/stl_vector.h:1199:20: note: no known conversion for argument 1 from '__complex__ int' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1199 | at(size_type __n) const
| ~~~~~~~~~~^~~
|
s583827763 | p03805 | C++ | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
bool abc[8][8];
int dfs(int a,int b,bool c[8]){
bool abcd=true;
for(int i=0;i<b;i++){
if(c[i]==false)
abcd=false;
}
if(abcd)
return 1;
int d=0;
for(int i=0;i<b;i++){
if(abc[a][i]==false)continue;
if(c[i])continue;
c[i]=true;
d+=dfs(i,n,c);
c[i]=false;
}
return d;
}
int main(){
int e,f;
cin >> e >> f;
int g[f],h[f];
for(int i=0;i<f;i++){
cin >> g[i] >> h[i];
abc[g[i]-1][h[i]-1] = abc[g[i]-1][h[i]-1] = true;
}
bool c[8];
for(int i=0;i<e;i++){
c[i]=false;
}
c[0]=true;
cout << dfs(0,e,c)<<endl;
}
| a.cc: In function 'int dfs(int, int, bool*)':
a.cc:24:14: error: 'n' was not declared in this scope
24 | d+=dfs(i,n,c);
| ^
|
s015739846 | p03805 | C++ | #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
bool abc[8][8];
int dfs(int a,int b,bool c[8]){
bool abcd=true;
for(int i=0;i<b;i++){
if(c[i]==false)
abcd=false;
}
if(abcd)
return 1;
int d=0;
for(int i=0;i<b;i++){
if(abc[a][i]==false)continue;
if(c[i])continue;
c[i]=true;
d+=dfs(i,n,visited);
c[i]=false;
}
return d;
}
int main(){
int e,f;
cin >> e >> f;
int g[f],h[f];
for(int i=0;i<f;i++){
cin >> g[i] >> h[i];
abc[g[i]-1][h[i]-1] = abc[g[i]-1][h[i]-1] = true;
}
bool c[8];
for(int i=0;i<e;i++){
c[i]=false;
}
c[0]=true;
cout << dfs(0,e,visited)<<endl;
}
| a.cc: In function 'int dfs(int, int, bool*)':
a.cc:24:14: error: 'n' was not declared in this scope
24 | d+=dfs(i,n,visited);
| ^
a.cc:24:16: error: 'visited' was not declared in this scope
24 | d+=dfs(i,n,visited);
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:46:19: error: 'visited' was not declared in this scope
46 | cout << dfs(0,e,visited)<<endl;
| ^~~~~~~
|
s306435827 | p03805 | C++ | /*
このコード、と~おれ!
Be accepted!
∧_∧
(。・ω・。)つ━☆・*。
⊂ ノ ・゜+.
しーJ °。+ *´¨)
.· ´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·'* ☆
*/
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.16f\n", a)//少数出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
using ll = long long;
const int INF = 2147483647;
const int MINF = -2147483648;
const ll LINF = ll(9223372036854775807);
const ll MOD = 1000000007;
const double PI = acos(-1);
//マクロとかここまで
using namespace std;
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a % b);
}
ll lcm(ll number1, ll number2) {//lcmを求める
return number1 * number2 / gcd(number1, number2);
}
bool is_prime(int64_t x) {//素数判定
for (int64_t i = 2; i * i <= x; i++) {
if (x % i == 0) return false;
}
return true;
}
ll nearPow2(ll n)//x以上の2のべき乗を返す
{
// nが0以下の時は0とする。
if (n <= 0) return 0;
// (n & (n - 1)) == 0 の時は、nが2の冪乗であるため、そのままnを返す。
if ((n & (n - 1)) == 0) return ll(n);
// bitシフトを用いて、2の冪乗を求める。
ll ret = 1;
while (n > 0) { ret <<= 1; n >>= 1; }
return ret;
}
map< int64_t, int > prime_factor(int64_t n) {//素因数分解
map< int64_t, int > ret;
for (int64_t i = 2; i * i <= n; i++) {
while (n % i == 0) {
ret[i]++;
n /= i;
}
}
if (n != 1) ret[n] = 1;
return ret;
}
template< int mod >
struct ModInt {
int x;
ModInt() : x(0) {}
ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
ModInt& operator+=(const ModInt& p) {
if ((x += p.x) >= mod) x -= mod;
return *this;
}
ModInt& operator-=(const ModInt& p) {
if ((x += mod - p.x) >= mod) x -= mod;
return *this;
}
ModInt& operator*=(const ModInt& p) {
x = (int)(1LL * x * p.x % mod);
return *this;
}
ModInt& operator/=(const ModInt& p) {
*this *= p.inverse();
return *this;
}
ModInt operator-() const { return ModInt(-x); }
ModInt operator+(const ModInt& p) const { return ModInt(*this) += p; }
ModInt operator-(const ModInt& p) const { return ModInt(*this) -= p; }
ModInt operator*(const ModInt& p) const { return ModInt(*this) *= p; }
ModInt operator/(const ModInt& p) const { return ModInt(*this) /= p; }
bool operator==(const ModInt& p) const { return x == p.x; }
bool operator!=(const ModInt& p) const { return x != p.x; }
ModInt inverse() const {
int a = x, b = mod, u = 1, v = 0, t;
while (b > 0) {
t = a / b;
swap(a -= t * b, b);
swap(u -= t * v, v);
}
return ModInt(u);
}
ModInt pow(int64_t n) const {
ModInt ret(1), mul(x);
while (n > 0) {
if (n & 1) ret *= mul;
mul *= mul;
n >>= 1;
}
return ret;
}
friend ostream& operator<<(ostream& os, const ModInt& p) {
return os << p.x;
}
friend istream& operator>>(istream& is, ModInt& a) {
int64_t t;
is >> t;
a = ModInt< mod >(t);
return (is);
}
static int get_mod() { return mod; }
};
using modint = ModInt< MOD >;//MOD=10億7
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
long long b = m, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
u %= m;
if (u < 0) u += m;
return u;
}
//nCrを1000000007で割った余りを求める
modint nCr(ll a, ll b) {
modint ans = 1;
for (ll i = 0; i < b; i++) {
ans *= a - i;
}
for (ll i = 1; i <= b; i++) {
ans *= modinv(i, MOD);
}
return ans;
}
void scans(string& str) {
char s[1000000];
scanf("%s", s);
str = s;
}
/*ライブラリメモ
*gcd:GCD(最大公約数)が求まる。O(log n)
*lcm:LCM(最小公倍数)が求まる。O(log n)
*is_prime:素数かどうかを返す。O(sqrt(n))
*nearPow2:任意の数以上の最小の2のべき乗を求める。計算量不明(そんなに遅くない)
*prime_factor:素因数分解、mapで返す。O(sqrt(n))
*ModInt<MOD>:MODで常に割られる数。徐算のみO(log n)
*modint:ModInt<10億7>
*modinv:mod. m での a の逆元 a^{-1} を計算するらしい。O(log m)
*nCr:nCrをMODで割った余りを求める。O(n + log MOD)
*scans:stringにscanfする。
*///終わり
/*-----------------------------------------ここまでライブラリとか-----------------------------------------*/
void printb(unsigned int v) {
unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
do putchar(mask & v ? '1' : '0');
while (mask >>= 1);
}
void putb(unsigned int v) {
putchar('0'), putchar('b'), printb(v), putchar('\n');
}
void dfs(int now, vector<vector<int>> ki, int flag, int &ans, int n) {
//printb(flag);
if (flag == (1 << n) - 1) {
++ans;
return;
}
else {
for (auto next : ki[now]) {
if ((flag & (1 << next)) == 0) {
//printf("\n%d -> %d\n", now, next);
dfs(next, ki, flag + (1 << next), ans, n);
}
}
}
}
int main() {
int n, m, a, b, ans = 0, flag = 0;
scanf("%d%d", &n, &m);
vector<vector<int>> tree(n);
rep(i, m) {
scanf("%d%d", &a, &b);
tree[a - 1].pb(b - 1);
tree[b - 1].pb(a - 1);
}
dfs(0, tree, flag + 1, ans, n);
printf("%d\n", ans);
return 0;
}
| a.cc: In function 'void printb(unsigned int)':
a.cc:220:52: error: 'CHAR_BIT' was not declared in this scope
220 | unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
| ^~~~~~~~
a.cc:24:1: note: 'CHAR_BIT' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
23 | #include <queue>
+++ |+#include <climits>
24 |
|
s601844847 | p03805 | C++ | #include <iostream> | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s476538031 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int m[9][9];
int vis[9];
int sum,n;
void dfs(int cot,int num){
if(num==n){
sum++;
return;
}
for(int i=2;i<10;i++){
if(m[cot][i]==1&&vis[i]==0){
vis[i]=1;
dfs(i,num+1);
vis[i]=0;
}
}
}
int main(){
int m,a,b;
cin>>n>>m;
for(int i = 0;i<m;i++){
cin>>a>>b;
m[a][b]=1;
m[b][a]=1;
}
sum = 0;
vis[1]=1;
dfs(1,1);
cout<<sum;
return 0;
} | a.cc: In function 'int main()':
a.cc:24:10: error: invalid types 'int[int]' for array subscript
24 | m[a][b]=1;
| ^
a.cc:25:10: error: invalid types 'int[int]' for array subscript
25 | m[b][a]=1;
| ^
|
s716190526 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int m[9][9];
int vis[9][9];
int sum,n;
void dfs(int cot,int num){
if(num==n){
sum++;
return;
}
for(int i=2;i<10;i++){
if(m[cot][i]==1&&vis[cot][i]==0){
vis[i]=1;
dfs(i,num+1);
vis[i]=0;
}
}
}
int main(){
int m,a,b;
cin>>n>>m;
for(int i = 0;i<m;i++){
cin>>a>>b;
m[a][b]=1;
m[b][a]=1;
}
sum = 0;
vis[1]=1;
dfs(1,1);
cout<<sum;
return 0;
} | a.cc: In function 'void dfs(int, int)':
a.cc:13:19: error: incompatible types in assignment of 'int' to 'int [9]'
13 | vis[i]=1;
| ~~~~~~^~
a.cc:15:19: error: incompatible types in assignment of 'int' to 'int [9]'
15 | vis[i]=0;
| ~~~~~~^~
a.cc: In function 'int main()':
a.cc:24:10: error: invalid types 'int[int]' for array subscript
24 | m[a][b]=1;
| ^
a.cc:25:10: error: invalid types 'int[int]' for array subscript
25 | m[b][a]=1;
| ^
a.cc:28:11: error: incompatible types in assignment of 'int' to 'int [9]'
28 | vis[1]=1;
| ~~~~~~^~
|
s093871553 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
int m[9][9];
int vis[9][9];
int sum,n;
void dfs(int cot,int num){
if(num==n){
sum++;
return
}
for(int i=2;i<10;i++){
if(m[cot][i]==1&&vis[cot][i]==0){
vis[i]=1;
dfs(i,num+1);
vis[i]=0;
}
}
}
int main(){
int m,a,b;
cin>>n>>m;
for(int i = 0;i<m;i++){
cin>>a>>b;
m[a][b]=1;
m[b][a]=1;
}
sum = 0;
vis[1]=1;
dfs(1,1);
cout<<sum;
return 0;
} | a.cc: In function 'void dfs(int, int)':
a.cc:10:5: error: expected primary-expression before '}' token
10 | }
| ^
a.cc:9:15: error: expected ';' before '}' token
9 | return
| ^
| ;
10 | }
| ~
a.cc:13:19: error: incompatible types in assignment of 'int' to 'int [9]'
13 | vis[i]=1;
| ~~~~~~^~
a.cc:15:19: error: incompatible types in assignment of 'int' to 'int [9]'
15 | vis[i]=0;
| ~~~~~~^~
a.cc: In function 'int main()':
a.cc:24:10: error: invalid types 'int[int]' for array subscript
24 | m[a][b]=1;
| ^
a.cc:25:10: error: invalid types 'int[int]' for array subscript
25 | m[b][a]=1;
| ^
a.cc:28:11: error: incompatible types in assignment of 'int' to 'int [9]'
28 | vis[1]=1;
| ~~~~~~^~
|
s323518326 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
const int max_int = 100;
vector<vector<bool>> G(max_int, vector<bool>(max_int, false));
int visit(int v, int N, vector<bool> visited){
bool all_visited = true;
for(int i = 0; i < visited.size(); i++){
if(visited[i] == false) all_visited = false;
}
int ret = 0;
if(all_visited) return 1;
else{
for(int j = 0; j < N ;j++){
if(G[v][j] == true){
visited[j] = true;
ret += visit(j, N, visited);
}
}
}
return ret;
}
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<bool> visited(N,false);
//頂点1からスタート
int ans = visit(0, N, &visited);
}
| a.cc: In function 'int main()':
a.cc:41:25: error: could not convert '& visited' from 'std::vector<bool>*' to 'std::vector<bool>'
41 | int ans = visit(0, N, &visited);
| ^~~~~~~~
| |
| std::vector<bool>*
|
s097453857 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
const int max_int = 8;
vector<vector<bool>> G(max_int, vector<bool>(max_int, false));
int visit(int v, int N, vector<bool> visited){
bool all_visited = true;
for(int i = 0; i < visited.size(); i++){
if(visited[i] == false) all_visited false;
}
int ret = 0;
if(all_visited) return 1;
else{
for(int j = 0; j < N ;j++){
if(G[v][j] == true){
visited[j] = true;
ret += visit(j, N, visited);
}
}
}
return ret;
}
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<bool> visited(N,false);
//頂点1からスタート
int ans = visit(0, N, visited);
}
| a.cc: In function 'int visit(int, int, std::vector<bool>)':
a.cc:12:40: error: expected ';' before 'false'
12 | if(visited[i] == false) all_visited false;
| ^~~~~~
| ;
|
s626834725 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
const int max_int = 8;
vector<vector<bool>> G(max_int, vector<bool>(max_int, false));
int visit(int v, int N, vector<bool> visited){
bool all_visited = true;
for(int i = 0; i < visited.size(); i++){
if(visited[i] == false) all_visited false;
}
if(all_visited) return 1;
int ret = 0;
else{
for(int j = 0; j < N ;j++){
if(G[v][j] == true){
visited[j] = true;
ret += visit(j, N, visited);
}
}
}
return ret;
}
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<bool> visited(N,false);
//頂点1からスタート
int ans = visit(0, N, visited);
}
| a.cc: In function 'int visit(int, int, std::vector<bool>)':
a.cc:12:40: error: expected ';' before 'false'
12 | if(visited[i] == false) all_visited false;
| ^~~~~~
| ;
a.cc:17:3: error: 'else' without a previous 'if'
17 | else{
| ^~~~
|
s678645967 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
const max_int = 8;
vector<vector<bool>> G(max_int, vector<bool>(max_int, false));
int visit(int v, int N, vector<bool> visited){
bool all_visited = true;
for(int i = 0; i < visited.size(); i++){
if(visited[i] == false) all_visited false;
}
if(all_visited) return 1;
int ret = 0;
else{
for(int j = 0; j < N ;j++){
if(G[v][j] == true){
visited[j] = true;
ret += visit(j, N, visited);
}
}
}
return ret;
}
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<bool> visited(N,false);
//頂点1からスタート
int ans = visit(0, N, visited);
} | a.cc:6:7: error: 'max_int' does not name a type; did you mean 'u_int'?
6 | const max_int = 8;
| ^~~~~~~
| u_int
a.cc:7:24: error: 'max_int' was not declared in this scope; did you mean 'u_int'?
7 | vector<vector<bool>> G(max_int, vector<bool>(max_int, false));
| ^~~~~~~
| u_int
a.cc:7:46: error: 'max_int' was not declared in this scope; did you mean 'u_int'?
7 | vector<vector<bool>> G(max_int, vector<bool>(max_int, false));
| ^~~~~~~
| u_int
a.cc: In function 'int visit(int, int, std::vector<bool>)':
a.cc:12:40: error: expected ';' before 'false'
12 | if(visited[i] == false) all_visited false;
| ^~~~~~
| ;
a.cc:17:3: error: 'else' without a previous 'if'
17 | else{
| ^~~~
|
s534765309 | p03805 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int lcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return d*e/f;
}
int gcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return f;
}
int a,b;
vector<int> graph[10];
int answer=0;
bool visited[10];
void dfs(int c,int d){
visited[c]=true;
d++;
if(d==a){
answer++;
}
for(int e:graph[a]){
if(!visited)
dfs(e,d);
}
visited[c]==false;
}
signed main(){
cin>>a>>b;
rep(i,M){
int A,B;
cin>>A>>B;
graph[B-1].push_back(A-1);
graph[A-1].push_back(B-1);
}
dfs(0,0);
cout<<answer<<endl;
}
| a.cc: In function 'int main()':
a.cc:69:9: error: 'M' was not declared in this scope
69 | rep(i,M){
| ^
a.cc:3:32: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
|
s967312516 | p03805 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int lcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return d*e/f;
}
int gcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return f;
}
int a,b;
vector<int> graph[10];
int answer=0;
bool visited[10];
void dfs(int c,int d){
visited[c]=true;
d++;
if(d==a){
answer++;
}
for(int e:graph[a]){
if(!visited)
dfs(e,d);
}
visited[c]==false;
}
signed main(){
cin>>a>>b;
rep(0,M){
int A,B;
cin>>A>>B;
graph[B-1].push_back(A-1);
graph[A-1].push_back(B-1);
}
dfs(0,0);
cout<<answer<<endl;
}
| a.cc: In function 'int main()':
a.cc:69:7: error: expected unqualified-id before numeric constant
69 | rep(0,M){
| ^
a.cc:3:26: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:69:7: error: expected ';' before numeric constant
69 | rep(0,M){
| ^
a.cc:3:26: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:69:7: error: lvalue required as left operand of assignment
69 | rep(0,M){
| ^
a.cc:3:26: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:69:9: error: 'M' was not declared in this scope
69 | rep(0,M){
| ^
a.cc:3:32: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:3:33: error: expected ')' before ';' token
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ~ ^
a.cc:69:3: note: in expansion of macro 'rep'
69 | rep(0,M){
| ^~~
a.cc:69:7: error: lvalue required as increment operand
69 | rep(0,M){
| ^
a.cc:3:36: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
|
s166156350 | p03805 | C++ | #include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
//桁
int kt(int a){
double b=a;
b=log10(b);
int c=b;
return c+1;
}
int lcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return d*e/f;
}
int gcm(int a,int b){
int d=a,e=b,f;
if(a<b)
swap(a,b);
int c,m=1;
while(m){
c=a%b;
if(c==0){
f=b;
m--;
}
else{
a=b;
b=c;
}
}
return f;
}
int a,b;
vector<int> graph[10];
int answer=0;
bool visited[10];
void dfs(int c,int d){
visited[c]==true;
d++;
if(d==a){
answer++;
}
for(int e:graph[a]){
if(!visited)
dfs(e,d)
}
visited[c]==false;
}
signed main(){
cin>>a>>b;
rep(0,M){
int A,B;
cin>>A>>B;
graph[B-1].push_back(A-1);
graph[A-1].push_back(B-1);
}
dfs(0,0);
cout<<answer<<endl;
}
| a.cc: In function 'void dfs(long long int, long long int)':
a.cc:63:15: error: expected ';' before '}' token
63 | dfs(e,d)
| ^
| ;
64 | }
| ~
a.cc: In function 'int main()':
a.cc:69:7: error: expected unqualified-id before numeric constant
69 | rep(0,M){
| ^
a.cc:3:26: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:69:7: error: expected ';' before numeric constant
69 | rep(0,M){
| ^
a.cc:3:26: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:69:7: error: lvalue required as left operand of assignment
69 | rep(0,M){
| ^
a.cc:3:26: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:69:9: error: 'M' was not declared in this scope
69 | rep(0,M){
| ^
a.cc:3:32: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
a.cc:3:33: error: expected ')' before ';' token
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ~ ^
a.cc:69:3: note: in expansion of macro 'rep'
69 | rep(0,M){
| ^~~
a.cc:69:7: error: lvalue required as increment operand
69 | rep(0,M){
| ^
a.cc:3:36: note: in definition of macro 'rep'
3 | #define rep(i,n) for(int i=0;i<n;++i)
| ^
|
s933660788 | p03805 | C++ | #include<iostream>
#include<vector>
using namespace std;
using graph = vector<vector<int>>;
graph v(1000);
int c = 0;
int n,m;
vector<bool> seen;
void dfs(const graph &v, int q, int depth){
seen[q] = true;
int ok = 0;
for(int i = 0; i < n; i++){
if(seen[i + 1]) ok++;
}
if(ok == n) c++;
for (auto next_q : v[q]){
if(seen[next_q]) continue;
dfs(v, next_q, depth + 1);
if(q == 1){
seen.assign(n, false);
seen[1] = true;
seen[v] = true;
}
}
seen[q] = false;
}
int main(){
cin >> n >> m;
for(int i = 0; i < m; i++){
int a,b; cin >> a >> b;
v[a].push_back(b);
v[b].push_back(a);
}
seen.assign(n, false);
dfs(v, 1, 1);
cout << c << "\n";
return 0;
} | a.cc: In function 'void dfs(const graph&, int, int)':
a.cc:22:29: error: no match for 'operator[]' (operand types are 'std::vector<bool>' and 'const graph' {aka 'const std::vector<std::vector<int> >'})
22 | seen[v] = true;
| ^
In file included from /usr/include/c++/14/vector:67,
from a.cc:2:
/usr/include/c++/14/bits/stl_bvector.h:1086:7: note: candidate: 'std::vector<bool, _Alloc>::reference std::vector<bool, _Alloc>::operator[](size_type) [with _Alloc = std::allocator<bool>; reference = std::vector<bool>::reference; size_type = long unsigned int]'
1086 | operator[](size_type __n)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:1086:28: note: no known conversion for argument 1 from 'const graph' {aka 'const std::vector<std::vector<int> >'} to 'std::vector<bool>::size_type' {aka 'long unsigned int'}
1086 | operator[](size_type __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:1091:7: note: candidate: 'std::vector<bool, _Alloc>::const_reference std::vector<bool, _Alloc>::operator[](size_type) const [with _Alloc = std::allocator<bool>; const_reference = bool; size_type = long unsigned int]'
1091 | operator[](size_type __n) const
| ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:1091:28: note: no known conversion for argument 1 from 'const graph' {aka 'const std::vector<std::vector<int> >'} to 'std::vector<bool>::size_type' {aka 'long unsigned int'}
1091 | operator[](size_type __n) const
| ~~~~~~~~~~^~~
|
s277986792 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
vector<int> g[8];
int dfs(int v,int x) {
if (x==(1<<n)-1)
return 1;
int c=0;
for (int u:g[v]) {
if (~x&1<<u)
c+=dfs(u,x|1<<u);
}
return c;
}
int main() {
int m;
cin>>n>>m;
while (m--) {
int v,u;
cin>v>>u;
v--,u--;
g[v].push_back(u);
g[u].push_back(v);
}
cout<<dfs(0,1)<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:24:12: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
24 | cin>v>>u;
| ~~~^~~~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:24:12: note: candidate: 'operator>(int, int)' (built-in)
24 | cin>v>>u;
| ~~~^~~~~
a.cc:24:12: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to '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:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/regex.h:1236: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>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/regex.h:1329: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>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
24 | cin>v>>u;
| ^
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:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
24 | cin>v>>u;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
24 | cin>v>>u;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
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/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/string_view:702: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> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
24 | cin>v>>u;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
24 | cin>v>>u;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:24:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _A |
s327258104 | p03805 | C++ | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
int g[8][8];
int n;
int dfs(int v, vector<int> visited)
{
if (accumulate(ALL(visited), 0) == n)
return 1;
int sum = 0;
rep(i, n)
{
if (!g[v][i] || visited[i])
continue;
visited[i] = 1;
sum += dfs(i, visited);
visited[i] = 0;
}
return sum;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s910217429 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
if(a>b){
return b;
}
else{
return a;
}
}
ll max(ll a,ll b){
if(a>b){
return a;
}
else{
return b;
}
}
ll power(ll a,ll b){
ll ans=1;
for(ll i=1;i<=b;i++){
ans*=a;
}
return ans;
}
ll gcd(ll m,ll n){
if(n==0){
return m;
}
return gcd(n,m%n);
}
ll lcm(ll a,ll b){
ll g=gcd(a,b);
return a/gcd(a,b)*b;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
if(a>b){
return b;
}
else{
return a;
}
}
ll max(ll a,ll b){
if(a>b){
return a;
}
else{
return b;
}
}
ll power(ll a,ll b){
ll ans=1;
for(ll i=1;i<=b;i++){
ans*=a;
}
return ans;
}
ll gcd(ll m,ll n){
if(n==0){
return m;
}
return gcd(n,m%n);
}
ll lcm(ll a,ll b){
ll g=gcd(a,b);
return a/gcd(a,b)*b;
}
const ll limit=28;
ll a[limit];
ll b[limit];
bool G[limit][limit];
ll N,M;
ll dfs(ll v,bool visited[limit]){
bool ALL=true;
rep(i,N){
if(visited[i]==false){
ALL=false;
}
}
if(ALL){
return 1;//ALLの場合最終的には同じdfsにたどり着く?
}
ll ret=0;
rep(i,M){
if(G[v][i]==true&&visited[i]==false){
visited[i]=true;
ret+=dfs(i,visited);
visited[i]=false;
}
}
return ret;
}
int main(){
cin>>N>>M;
rep(i,M){
cin>>a[i]>>b[i];
G[a[i]-1][b[i]-1]=G[b[i]-1][a[i]-1]=true;
}
bool visited[limit];
rep(i,N){
visited[i]=false;
}
visited[0]=true;//0スタート固定?
cout<<dfs(0,visited)<<endl;
}
const ll limit=28;
ll a[limit];
ll b[limit];
bool G[limit][limit];
ll dfs(ll v,bool visited[limit]){
bool ALL=true;
rep(i,N){
if(visited[i]==false){
ALL=false;
}
}
if(ALL){
return 1;//ALLの場合最終的には同じdfsにたどり着く?
}
ll ret=0;
rep(i,M){
if(G[v][i]==true&&visited[i]==false){
visited[i]=true;
ret+=dfs(i,visited);
visited[i]=false;
}
}
return ret;
}
int main(){
cin>>N>>M;
rep(i,M){
cin>>a[i]>>b[i];
G[a[i]-1][b[i]-1]=G[b[i]-1][a[i]-1]=true;
}
bool visited[limit];
rep(i,N){
visited[i]=false;
}
visited[0]=true;//0スタート固定?
cout<<dfs(0,visited)<<endl;
}
| a.cc:49:10: error: redefinition of 'const ll mod'
49 | const ll mod=1e9+7;
| ^~~
a.cc:4:10: note: 'const ll mod' previously defined here
4 | const ll mod=1e9+7;
| ^~~
a.cc:50:10: error: redefinition of 'const ll INF'
50 | const ll INF=mod*mod;
| ^~~
a.cc:5:10: note: 'const ll INF' previously defined here
5 | const ll INF=mod*mod;
| ^~~
a.cc:53:4: error: redefinition of 'll min(ll, ll)'
53 | ll min(ll a,ll b){
| ^~~
a.cc:8:4: note: 'll min(ll, ll)' previously defined here
8 | ll min(ll a,ll b){
| ^~~
a.cc:62:6: error: redefinition of 'll max(ll, ll)'
62 | ll max(ll a,ll b){
| ^~~
a.cc:17:6: note: 'll max(ll, ll)' previously defined here
17 | ll max(ll a,ll b){
| ^~~
a.cc:71:4: error: redefinition of 'll power(ll, ll)'
71 | ll power(ll a,ll b){
| ^~~~~
a.cc:26:4: note: 'll power(ll, ll)' previously defined here
26 | ll power(ll a,ll b){
| ^~~~~
a.cc:79:5: error: redefinition of 'll gcd(ll, ll)'
79 | ll gcd(ll m,ll n){
| ^~~
a.cc:34:5: note: 'll gcd(ll, ll)' previously defined here
34 | ll gcd(ll m,ll n){
| ^~~
a.cc:85:4: error: redefinition of 'll lcm(ll, ll)'
85 | ll lcm(ll a,ll b){
| ^~~
a.cc:40:4: note: 'll lcm(ll, ll)' previously defined here
40 | ll lcm(ll a,ll b){
| ^~~
a.cc:149:10: error: redefinition of 'const ll limit'
149 | const ll limit=28;
| ^~~~~
a.cc:91:10: note: 'const ll limit' previously defined here
91 | const ll limit=28;
| ^~~~~
a.cc:150:4: error: redefinition of 'll a [28]'
150 | ll a[limit];
| ^
a.cc:92:4: note: 'll a [28]' previously declared here
92 | ll a[limit];
| ^
a.cc:151:4: error: redefinition of 'll b [28]'
151 | ll b[limit];
| ^
a.cc:93:4: note: 'll b [28]' previously declared here
93 | ll b[limit];
| ^
a.cc:152:6: error: redefinition of 'bool G [28][28]'
152 | bool G[limit][limit];
| ^
a.cc:94:6: note: 'bool G [28][28]' previously declared here
94 | bool G[limit][limit];
| ^
a.cc:155:4: error: redefinition of 'll dfs(ll, bool*)'
155 | ll dfs(ll v,bool visited[limit]){
| ^~~
a.cc:97:4: note: 'll dfs(ll, bool*)' previously defined here
97 | ll dfs(ll v,bool visited[limit]){
| ^~~
a.cc:186:5: error: redefinition of 'int main()'
186 | int main(){
| ^~~~
a.cc:128:5: note: 'int main()' previously defined here
128 | int main(){
| ^~~~
|
s290953362 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
vector<vector<int>>E(100);
int ans=0;
int n,m;
void dfs(int now,int vis){
if(vis==(1<<n)-1){ans++;return;}
for(auto a:E[now]){
if(vis&(1<<a) == 0){
dfs(a,vis|(1<<a));
}
}
return;
}
int main(){
cin>>n>>m;
for(int i=0;i<m;i++){
int a,b;cin>>a>>b;
E[--a].pb(--b);
E[b].pb(a);
}
dfs(0,1);
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:19:12: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'pb'
19 | E[--a].pb(--b);
| ^~
a.cc:20:10: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'pb'
20 | E[b].pb(a);
| ^~
|
s489935316 | p03805 | C++ | #include<iostream>
#include<vector>
using namespace std;
int bfs(int now,int n,vector<int> *v,bool visited[n]){
visited[now] = true;
int path = 0;
//cout << "Now=" << now <<endl;
for(int i=0;i<n;i++){
if(!visited[i]){
break;
}
if(i==n-1){
return 1;
}
}
for(int i=0;i<v[now].size();i++){
if(visited[v[now][i]] == true){
continue;
}
path += bfs(v[now][i],n,v,visited);
visited[v[now][i]] = false;
}
return path;
}
int main(){
int n,m;
cin >> n >> m;
vector <int> v[n];
for(int i=0;i<m;i++){
int a,b;
cin >> a >> b;
a--;b--;
v[a].push_back(b);
v[b].push_back(a);
}
bool visited[n];
for(int i=0;i<n;i++){
visited[i] = false;
}
/*
for(int i=0;i<n;i++){
for(int j=0;j<v[i].size();j++){
cout << v[i][j] << " " ;
}
cout << endl;
}*/
int ans = bfs(0,n,v,visited);
cout << ans <<endl;return 0;
} | a.cc:6:52: error: use of parameter outside function body before ']' token
6 | int bfs(int now,int n,vector<int> *v,bool visited[n]){
| ^
a.cc: In function 'int bfs(...)':
a.cc:7:5: error: 'visited' was not declared in this scope
7 | visited[now] = true;
| ^~~~~~~
a.cc:7:13: error: 'now' was not declared in this scope
7 | visited[now] = true;
| ^~~
a.cc:10:19: error: 'n' was not declared in this scope
10 | for(int i=0;i<n;i++){
| ^
a.cc:19:19: error: 'v' was not declared in this scope
19 | for(int i=0;i<v[now].size();i++){
| ^
a.cc:23:31: error: 'n' was not declared in this scope
23 | path += bfs(v[now][i],n,v,visited);
| ^
|
s584868991 | 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;
}
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;
visietd[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 dfs(int, int, bool*)':
a.cc:25:5: error: 'visietd' was not declared in this scope; did you mean 'visited'?
25 | visietd[i] = true;
| ^~~~~~~
| visited
|
s458161891 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long 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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector <T> v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;
bool graph[10][10];
signed main(){
int n,m;
cin>>n>>m;
graph.assign(n,vector<int>());
for (int i = 0; i < m; i++)
{
int a,b;
cin>>a>>b;
a--,b--;
graph[a][b]=true;
}
vector<int>v;
REP(i,n) v.push_back(i);
int cnt=0;
do{
if(v[0]!=0) continue;
bool flag=true;
for (int i = 0; i < n-1; i++)
{
if(!graph[v[i]][v[i+1]]){
flag=false;
break;
}
}
if(flag) cnt++;
}while(next_permutation(ALL(v)));
cout<<cnt<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:11: error: request for member 'assign' in 'graph', which is of non-class type 'bool [10][10]'
30 | graph.assign(n,vector<int>());
| ^~~~~~
|
s984075884 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep for(int i = 0;i<n;i++)
const int MOD = 1000000007;
int n,m, ans;
bool graph[n][n],frag[n];
void dfs(bool a,int b,int c){
if(b == n){
ans += 1; return;
}
for(int i = 0;i<n;i++){
if(a[i] == false and graph[c][i] == true){
a[i] = true; dfs(a,b+1, i);
}
}
}
int main(){
cin >> n >> m;
for(int i = 0;i<m;i++){
int ai,bi;cin >> ai >> bi;
graph[ai-1][bi-1] = true;graph[bi-1][ai-1] = true;
}
ans = 0;
frag[0] = true;
dfs(frag, 1, 0);
cout << ans << endl;
} | a.cc:8:15: error: size of array 'graph' is not an integral constant-expression
8 | bool graph[n][n],frag[n];
| ^
a.cc:8:12: error: size of array 'graph' is not an integral constant-expression
8 | bool graph[n][n],frag[n];
| ^
a.cc:8:23: error: size of array 'frag' is not an integral constant-expression
8 | bool graph[n][n],frag[n];
| ^
a.cc: In function 'void dfs(bool, int, int)':
a.cc:15:21: error: invalid types 'bool[int]' for array subscript
15 | if(a[i] == false and graph[c][i] == true){
| ^
a.cc:16:22: error: invalid types 'bool[int]' for array subscript
16 | a[i] = true; dfs(a,b+1, i);
| ^
|
s075564100 | p03805 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const int MAX = 8;
bool G[MAX][MAX];
int dfs(int v, int n, bool visited[max]) {
bool all_visited = true;
rep(i, n) {
if(!visited[i]) {
all_visited = false;
}
}
if(all_visited) {
return 1;
}
int ret = 0;
rep(i, n) {
if(!G[v][i]) {
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;
rep(i, m) {
int a, b;
cin >> a >> b;
a--; b--;
G[a][b] = G[b][a] = true;
}
bool visited[MAX];
rep(i, n) {
visited[i] = false;
}
visited[0] = true;
cout << dfs(0, n, visited);
cout << endl;
return 0;
} | a.cc:14:39: error: cannot resolve overloaded function 'max' based on conversion to type 'long unsigned int'
14 | int dfs(int v, int n, bool visited[max]) {
| ^
a.cc:14:28: error: size of array 'visited' has non-integral type '<unresolved overloaded function type>'
14 | int dfs(int v, int n, bool visited[max]) {
| ^~~~~~~
|
s797455867 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<int> d[10];
struct mode{
int n;
bool has[10];
};
mode dfs[100000];
int main()
{
int n,m,i,j,a,b,top,tmp,count,ans;
bool hast[10];
cin>>n>>m;
for(i=0;i<m;i++)
{
cin>>a>>b
if(b!=1) d[a].push_back(b);
if(a!=1) d[b].push_back(a);
}
top=0,dfs[0].n=1,dfs[0].has[1]=1,ans=0;
while(top>=0)
{
tmp = dfs[top].n,count=0;
for(i=1;i<=n;i++) hast[i]=dfs[top].has[i],count+=hast[i];
top--;
if(count==n)
{
ans++;
continue;
}
for(i=0;i<d[tmp].size();i++)
{
if(!(hast[d[tmp][i]]))
{
dfs[++top].n=d[tmp][i];
for(j=1;j<=n;j++) dfs[top].has[j]=hast[j];
dfs[top].has[d[tmp][i]] = 1;
}
}
}
cout<<ans;
} | a.cc: In function 'int main()':
a.cc:20:26: error: expected ';' before 'if'
20 | cin>>a>>b
| ^
| ;
21 | if(b!=1) d[a].push_back(b);
| ~~
|
s718219099 | p03805 | C++ | #include <bits/stdc++.h>
#define infi 2e9
#define infl 5e18
#define MX 100005
#define pi 2*acos(0.0)
#define ll long long
#define rr read()
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ms(a,b) memset(a, b, sizeof(a))
#define loop(i,n) for(register int i=0;i<n;i++)
#define loop1(i,n) for(register int i=1;i<=n;i++)
using namespace std;
inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
// inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
// inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
// inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}
// //************************************* Bitmask Opereations **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//
int cnt=0,n;
bool vis[10]={0};
vector<int>adj[10];
void DFS(int u, int p, int nod){
if(nod==n)cnt++;
vis[v]=1;
for(auto v:adj[u]){
if(v!=p && !vis[v]){
DFS(v,u,nod+1);
}
}
vis[u]=0;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
//#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif
//freopen("in.txt", "r", stdin);
n=rr;
int m=rr,x,y;
loop(i,m){
x=rr;y=rr;
adj[x].pb(y);
adj[y].pb(x);
}
if(m<n-1){
cout << 0 << endl;
return 0;
}
DFS(1,0,1);
cout << cnt << endl;
return 0;
}
| a.cc: In function 'void DFS(int, int, int)':
a.cc:37:9: error: 'v' was not declared in this scope
37 | vis[v]=1;
| ^
a.cc: In function 'int main()':
a.cc:53:10: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
53 | loop(i,m){
| ^
a.cc:15:42: note: in definition of macro 'loop'
15 | #define loop(i,n) for(register int i=0;i<n;i++)
| ^
|
s181439178 | p03805 | C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( i = a; i < b ; i++)
#define REP(i, n) for ( i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))
/* const */
const int MOD = (int)1e9 + 7;
/* alias */
typedef long long ll;
/* function */
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
return *(int*)b - *(int*)a;
}
/* main */
int i, j, k;
int n, m, a, b, x = 0, ver[8][8] = { 0 }, visited[nmax] = { 1 };
int visit(int x, int visited[nmax]) {
int all_visited = 1;
REP(i, n) if (visited[i] == 0) all_visited = 0;
if (all_visited) {
printf("\n");
return 1;
}
int c = 0;
REP(i, n) {
if (visited[i] == 0 && ver[x][i] == 1) {
visited[i] = 1;
printf("%d", x);
c += visit(i, visited);
visited[i] = 0;
}
}
return c;
}
int main() {
scanf("%d%d", &n, &m);
REP(i, m) {
scanf("%d%d", &a, &b);
ver[a - 1][b - 1] = 1;
ver[b - 1][a - 1] = 1;
}
printf("%d\n", visit(x, visited));
return 0;
} | main.c:35:51: error: 'nmax' undeclared here (not in a function); did you mean 'fmax'?
35 | int n, m, a, b, x = 0, ver[8][8] = { 0 }, visited[nmax] = { 1 };
| ^~~~
| fmax
main.c: In function 'visit':
main.c:50:39: error: type of formal parameter 2 is incomplete
50 | c += visit(i, visited);
| ^~~~~~~
main.c: In function 'main':
main.c:64:33: error: type of formal parameter 2 is incomplete
64 | printf("%d\n", visit(x, visited));
| ^~~~~~~
|
s791411127 | p03805 | C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( i = a; i < b ; i++)
#define REP(i, n) for ( i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))
/* const */
const int MOD = (int)1e9 + 7;
/* alias */
typedef long long ll;
/* function */
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
return *(int*)b - *(int*)a;
}
/* main */
int i, j, k;
const int nmax = 8;
int n, m, a, b, x = 0, ver[nmax][nmax] = { 0 }, visited[nmax] = { 1 };
int visit(int x, int visited[nmax]) {
int all_visited = 1;
REP(i, n) if (visited[i] == 0) all_visited = 0;
if (all_visited) {
printf("\n");
return 1;
}
int c = 0;
REP(i, n) {
if (visited[i] == 0 && ver[x][i] == 1) {
visited[i] = 1;
printf("%d", x);
c += visit(i, visited);
visited[i] = 0;
}
}
return c;
}
int main() {
scanf("%d%d", &n, &m);
REP(i, m) {
scanf("%d%d", &a, &b);
ver[a - 1][b - 1] = 1;
ver[b - 1][a - 1] = 1;
}
printf("%d\n", visit(x, visited));
return 0;
} | main.c:36:24: error: variably modified 'ver' at file scope
36 | int n, m, a, b, x = 0, ver[nmax][nmax] = { 0 }, visited[nmax] = { 1 };
| ^~~
main.c:36:24: error: variably modified 'ver' at file scope
main.c:36:49: error: variably modified 'visited' at file scope
36 | int n, m, a, b, x = 0, ver[nmax][nmax] = { 0 }, visited[nmax] = { 1 };
| ^~~~~~~
|
s957798603 | p03805 | C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( i = a; i < b ; i++)
#define REP(i, n) for ( i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))
/* const */
const int MOD = (int)1e9 + 7;
/* alias */
typedef long long ll;
/* function */
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
return *(int*)b - *(int*)a;
}
/* main */
int i, j, k;
const int nmax = 8;
int n, m, a, b, x = 0, ver[nmax][nmax] = { false }, visited[nmax] = { true };
int visit(int x, int visited[nmax]) {
int all_visited = true;
REP(i, n) if (visited[i] == false) all_visited = false;
if (all_visited) {
printf("\n");
return 1;
}
int c = 0;
REP(i, n) {
if (visited[i] == false && ver[x][i] == true) {
visited[i] = true;
printf("%d", x);
c += visit(i, visited);
visited[i] = false;
}
}
return c;
}
int main() {
scanf("%d%d", &n, &m);
REP(i, m) {
scanf("%d%d", &a, &b);
ver[a - 1][b - 1] = true;
ver[b - 1][a - 1] = true;
}
printf("%d\n", visit(x, visited));
return 0;
} | main.c:36:24: error: variably modified 'ver' at file scope
36 | int n, m, a, b, x = 0, ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~
main.c:36:24: error: variably modified 'ver' at file scope
main.c:36:44: error: 'false' undeclared here (not in a function)
36 | int n, m, a, b, x = 0, ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~~~
main.c:7:1: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
6 | #include <math.h>
+++ |+#include <stdbool.h>
7 |
main.c:36:53: error: variably modified 'visited' at file scope
36 | int n, m, a, b, x = 0, ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~~~~~
main.c:36:71: error: 'true' undeclared here (not in a function)
36 | int n, m, a, b, x = 0, ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~~
main.c:36:71: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s378565219 | p03805 | C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( i = a; i < b ; i++)
#define REP(i, n) for ( i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))
/* const */
const int MOD = (int)1e9 + 7;
/* alias */
typedef long long ll;
/* function */
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
return *(int*)b - *(int*)a;
}
/* main */
int i, j, k;
const int nmax = 8;
int n, m, a, b, x = 0;
bool ver[nmax][nmax] = { false }, visited[nmax] = { true };
int visit(int x, bool visited[nmax]) {
bool all_visited = true;
REP(i, n) if (visited[i] == false) all_visited = false;
if (all_visited) {
printf("\n");
return 1;
}
int c = 0;
REP(i, n) {
if (visited[i] == false && ver[x][i] == true) {
visited[i] = true;
printf("%d", x);
c += visit(i, visited);
visited[i] = false;
}
}
return c;
}
int main() {
scanf("%d%d", &n, &m);
REP(i, m) {
scanf("%d%d", &a, &b);
ver[a - 1][b - 1] = true;
ver[b - 1][a - 1] = true;
}
printf("%d\n", visit(x, visited));
return 0;
} | main.c:37:1: error: unknown type name 'bool'
37 | bool ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~~
main.c:7:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
6 | #include <math.h>
+++ |+#include <stdbool.h>
7 |
main.c:37:6: error: variably modified 'ver' at file scope
37 | bool ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~
main.c:37:6: error: variably modified 'ver' at file scope
main.c:37:26: error: 'false' undeclared here (not in a function)
37 | bool ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~~~
main.c:37:26: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:37:35: error: variably modified 'visited' at file scope
37 | bool ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~~~~~
main.c:37:53: error: 'true' undeclared here (not in a function)
37 | bool ver[nmax][nmax] = { false }, visited[nmax] = { true };
| ^~~~
main.c:37:53: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:40:18: error: unknown type name 'bool'
40 | int visit(int x, bool visited[nmax]) {
| ^~~~
main.c:40:18: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'main':
main.c:66:24: error: implicit declaration of function 'visit' [-Wimplicit-function-declaration]
66 | printf("%d\n", visit(x, visited));
| ^~~~~
|
s567798063 | p03805 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
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:49:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
49 | cin >> N >> M;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:63:2: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
63 | cout << dfs(0,N,visited) << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:63:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
63 | cout << dfs(0,N,visited) << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s410903433 | p03805 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
vector<int> G[9];
bool used[9];
int dfs(int v,vector<bool> used){
int n=used.size();
bool flag = true;
REP(i,n){
if(!used[i]){
flag = false;
}
}
if(flag){
return 1;
}
int res=0;
for(int i=0;i<G[v].size();i++){
if(used[G[v][i]]){
continue;
}else{
used[G[v][i]]=true;
res += dfs(G[v][i],used);
used[G[v][i]]=false;
}
}
return res;
}
int main(){
int n,m;
cin>>n>>m;
int a,b;
REP(i,m){
cin>>a>>b;
a--;b--;
G[a].push_back(b);
G[b].push_back(a);
}
int ans;
used[0]=true;
ans = dfs(0,used);
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:130:15: error: could not convert '(bool*)(& used)' from 'bool*' to 'std::vector<bool>'
130 | ans = dfs(0,used);
| ^~~~
| |
| bool*
|
s900616798 | p03805 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
vector<int> G(9);
bool used[9];
int dfs(int v,vector<bool> used){
int n=used.size();
bool flag = true;
REP(i,n){
if(!used[i]){
flag = false;
}
}
if(flag){
return 1;
}
int res=0;
int adj=G[v].size();
for(int i=0;i<adj;i++){
if(used[G[v][i]]){
continue;
}else{
used[G[v][i]]=true;
res += dfs(G[v][i],used);
used[G[v][i]]=false;
}
}
return res;
}
int main(){
int n,m;
cin>>n>>m;
int a,b;
REP(i,m){
cin>>a>>b;
a--;b--;
G[a].push_back(b);
G[b].push_back(a);
}
int ans;
used[0]=true;
ans = dfs(0,used);
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int dfs(int, std::vector<bool>)':
a.cc:106:16: error: request for member 'size' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
106 | int adj=G[v].size();
| ^~~~
a.cc:108:17: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
108 | if(used[G[v][i]]){
| ^
a.cc:111:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
111 | used[G[v][i]]=true;
| ^
a.cc:112:22: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
112 | res += dfs(G[v][i],used);
| ^
a.cc:113:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
113 | used[G[v][i]]=false;
| ^
a.cc: In function 'int main()':
a.cc:126:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
126 | G[a].push_back(b);
| ^~~~~~~~~
a.cc:127:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
127 | G[b].push_back(a);
| ^~~~~~~~~
a.cc:131:15: error: could not convert '(bool*)(& used)' from 'bool*' to 'std::vector<bool>'
131 | ans = dfs(0,used);
| ^~~~
| |
| bool*
|
s392644729 | p03805 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
vector<int> G(9);
bool used[9];
int dfs(int v,vector<bool> used){
int n=used.size();
bool flag = true;
REP(i,n){
if(!used[i]){
flag = false;
}
}
if(flag){
return 1;
}
int res=0;
for(int i=0;i<(int)(G[v].size());i++){
if(used[G[v][i]]){
continue;
}else{
used[G[v][i]]=true;
res += dfs(G[v][i],used);
used[G[v][i]]=false;
}
}
return res;
}
int main(){
int n,m;
cin>>n>>m;
int a,b;
REP(i,m){
cin>>a>>b;
a--;b--;
G[a].push_back(b);
G[b].push_back(a);
}
int ans;
used[0]=true;
ans = dfs(0,used);
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int dfs(int, std::vector<bool>)':
a.cc:106:28: error: request for member 'size' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
106 | for(int i=0;i<(int)(G[v].size());i++){
| ^~~~
a.cc:107:17: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
107 | if(used[G[v][i]]){
| ^
a.cc:110:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
110 | used[G[v][i]]=true;
| ^
a.cc:111:22: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
111 | res += dfs(G[v][i],used);
| ^
a.cc:112:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
112 | used[G[v][i]]=false;
| ^
a.cc: In function 'int main()':
a.cc:125:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
125 | G[a].push_back(b);
| ^~~~~~~~~
a.cc:126:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
126 | G[b].push_back(a);
| ^~~~~~~~~
a.cc:130:15: error: could not convert '(bool*)(& used)' from 'bool*' to 'std::vector<bool>'
130 | ans = dfs(0,used);
| ^~~~
| |
| bool*
|
s868708326 | p03805 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
vector<int> G(9);
bool used[9];
int dfs(int v,vector<bool> used){
int n=used.size();
bool flag = true;
REP(i,n){
if(!used[i]){
flag = false;
}
}
if(flag){
return 1;
}
int res=0;
for(int i=0;i<(int)G[v].size();i++){
if(used[G[v][i]]){
continue;
}else{
used[G[v][i]]=true;
res += dfs(G[v][i],used);
used[G[v][i]]=false;
}
}
return res;
}
int main(){
int n,m;
cin>>n>>m;
int a,b;
REP(i,m){
cin>>a>>b;
a--;b--;
G[a].push_back(b);
G[b].push_back(a);
}
int ans;
used[0]=true;
ans = dfs(0,used);
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int dfs(int, std::vector<bool>)':
a.cc:106:27: error: request for member 'size' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
106 | for(int i=0;i<(int)G[v].size();i++){
| ^~~~
a.cc:107:17: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
107 | if(used[G[v][i]]){
| ^
a.cc:110:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
110 | used[G[v][i]]=true;
| ^
a.cc:111:22: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
111 | res += dfs(G[v][i],used);
| ^
a.cc:112:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
112 | used[G[v][i]]=false;
| ^
a.cc: In function 'int main()':
a.cc:125:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
125 | G[a].push_back(b);
| ^~~~~~~~~
a.cc:126:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
126 | G[b].push_back(a);
| ^~~~~~~~~
a.cc:130:15: error: could not convert '(bool*)(& used)' from 'bool*' to 'std::vector<bool>'
130 | ans = dfs(0,used);
| ^~~~
| |
| bool*
|
s570811391 | p03805 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
vector<int> G(9);
bool used[9];
int dfs(int v,vector<bool> used){
int n=used.size();
bool flag = true;
REP(i,n){
if(!used[i]){
flag = false;
}
}
if(flag){
return 1;
}
int res=0;
for(int i=0;i<G[v].size();i++){
if(used[G[v][i]]){
continue;
}else{
used[G[v][i]]=true;
res += dfs(G[v][i],used);
used[G[v][i]]=false;
}
}
return res;
}
int main(){
int n,m;
cin>>n>>m;
int a,b;
REP(i,m){
cin>>a>>b;
a--;b--;
G[a].push_back(b);
G[b].push_back(a);
}
int ans;
used[0]=true;
ans = dfs(0,used);
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int dfs(int, std::vector<bool>)':
a.cc:106:22: error: request for member 'size' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)v))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
106 | for(int i=0;i<G[v].size();i++){
| ^~~~
a.cc:107:17: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
107 | if(used[G[v][i]]){
| ^
a.cc:110:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
110 | used[G[v][i]]=true;
| ^
a.cc:111:22: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
111 | res += dfs(G[v][i],used);
| ^
a.cc:112:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
112 | used[G[v][i]]=false;
| ^
a.cc: In function 'int main()':
a.cc:125:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
125 | G[a].push_back(b);
| ^~~~~~~~~
a.cc:126:10: error: request for member 'push_back' in 'G.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
126 | G[b].push_back(a);
| ^~~~~~~~~
a.cc:130:15: error: could not convert '(bool*)(& used)' from 'bool*' to 'std::vector<bool>'
130 | ans = dfs(0,used);
| ^~~~
| |
| bool*
|
s363541203 | p03805 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<unordered_map>
#include<stack>
#include<string>
#include<algorithm>
#include<functional>
#include<cstring>
#include<utility>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
/**** Type Define ****/
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;
/**** Const List ****/
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ll dx[4] = {1, 0, -1, 0};
const ll dy[4] = {0, -1, 0, 1};
/**** General Functions ****/
ll RepeatSquaring(ll N, ll P, ll M){
if(P==0) return 1;
if(P%2==0){
ll t = RepeatSquaring(N, P/2, M);
return t*t % M;
}
return N * RepeatSquaring(N, P-1, M);
}
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a % b);
}
ll extgcd(ll a, ll b, ll& x, ll& y) {
if (b == 0) {
x = 1, y = 0; return a;
}
ll q = a/b, g = extgcd(b, a - q*b, x, y);
ll z = x - q * y;
x = y;
y = z;
return g;
}
ll invmod (ll a, ll m) { // a^-1 mod m
ll x, y;
extgcd(a, m, x, y);
x %= m;
if (x < 0) x += m;
return x;
}
ll nCk(ll n, ll k, ll mod) {
ll ans = 1;
for (ll i = n, j = 1; j <= k; i--, j++) ans = (((ans * i) % mod) * invmod(j, mod)) % mod;
return ans;
}
ll lmin(ll a, ll b) { return a > b ? b : a; };
ll lmax(ll a, ll b) { return a > b ? a : b; };
ll lsum(ll a, ll b) { return a + b; };
/**** Zip ****/
template <typename T>
class Zip {
vector<T> d;
bool flag;
public:
Zip() {
flag = false;
}
void add(T x) {
d.push_back(x);
flag = true;
}
ll getNum(T x) { // T need to have operator < !!
if (flag) {
sort(d.begin(), d.end());
d.erase(unique(d.begin(), d.end()), d.end());
flag = false;
}
return lower_bound(d.begin(), d.end(), x) - d.begin();
}
ll size() {
if (flag) {
sort(d.begin(), d.end());
d.erase(unique(d.begin(), d.end()), d.end());
flag = false;
}
return (ll)d.size();
}
};
/**** Union Find ****/
class UnionFind {
vector<ll> par, rank; // par > 0: number, par < 0: -par
public:
void init(ll n) {
par.resize(n, 1); rank.resize(n, 0);
}
ll getSize(ll x) {
return par[find(x)];
}
ll find(ll x) {
if (par[x] > 0) return x;
return -(par[x] = -find(-par[x]));
}
void merge(ll x, ll y) {
x = find(x);
y = find(y);
if (x == y) return;
if (rank[x] < rank[y]) {
par[y] += par[x];
par[x] = -y;
} else {
par[x] += par[y];
par[y] = -x;
if (rank[x] == rank[y]) rank[x]++;
}
}
bool isSame(ll x, ll y) {
return find(x) == find(y);
}
};
/**** Segment Tree ****/
template <typename T>
class SegmentTree {
ll n;
vector<T> node;
function<T(T, T)> fun, fun2;
bool customChange;
T outValue, initValue;
public:
void init(ll num, function<T(T, T)> resultFunction, T init, T out, function<T(T, T)> changeFunction = NULL) {
// changeFunction: (input, beforevalue) => newvalue
fun = resultFunction;
fun2 = changeFunction;
customChange = changeFunction != NULL;
n = 1;
while (n < num) n *= 2;
node.resize(2 * n - 1, init);
outValue = out;
initValue = init;
}
void valueChange(ll num, T value) {
num += n-1;
if (customChange) node[num] = fun2(value, node[num]);
else node[num] = value;
while (num > 0) num = (num - 1) / 2, node[num] = fun(node[num * 2 + 1], node[num * 2 + 2]);
}
T rangeQuery(ll a, ll b, ll l = 0, ll r = -1, ll k = 0) { // [a, b)
if (r == -1) r = n;
if (a <= l && r <= b) return node[k];
if (b <= l || r <= a) return outValue;
ll mid = (l + r) / 2;
return fun(rangeQuery(a, b, l, mid, 2*k+1), rangeQuery(a, b, mid, r, 2*k+2));
}
};
/**** LIS ****/
ll lis(ll* a, ll n, ll* dp) {
fill(dp, dp + n, INF);//INFを代入
for (ll i = 0; i < n; i++) *lower_bound(dp, dp + n, a[i]) = a[i];
return (ll)(lower_bound(dp, dp + n, INF) - dp);
}
/**** main function ****/
ll n,m;
vector<ll> hen[9];
string num[1000000];
ll index;
ll ans;
int seisei(int a,int keta){
int acopy=a;
bool deta[10]={};
for(int i=0;i<10;i++){
deta[i]=false;
}
if(keta==n){
num[index]=to_string(a);
index++;
return a;
}
while(a!=0){
deta[a%10]=true;
a=a-(a%10);
a/=10;
}
for(int i=1;i<=n;i++){
if(!deta[i]){//でてない
seisei(acopy*10+i,keta+1);
}
}
}
int main(){
cin>>n>>m;
for(int i=0;i<m;i++){
ll a,b;
cin>>a>>b;
hen[a].push_back(b);
hen[b].push_back(a);
}
seisei(1,1);
for(int i=0;num[i]!="";i++){
string miti=num[i];
for(int j=0;j<miti.size()-1;j++){//mitiについての探索
bool atta=false;
for(int k=0;k<hen[miti[j]-'0'].size();k++){
if(hen[miti[j]-'0'][k]==(miti[j+1]-'0')){
atta=true;
break;
}
}
if(atta){
if(j==miti.size()-2){
ans++;
}
}else{
break;
}
}
}
cout<<ans<<endl;
}
| a.cc:191:4: error: 'll index' redeclared as different kind of entity
191 | ll index;
| ^~~~~
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from a.cc:11:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'int seisei(int, int)':
a.cc:201:8: error: invalid types 'std::string [1000000] {aka std::__cxx11::basic_string<char> [1000000]}[<unresolved overloaded function type>]' for array subscript
201 | num[index]=to_string(a);
| ^
a.cc:202:10: error: no post-increment operator for type
202 | index++;
| ^~
a.cc:215:1: warning: control reaches end of non-void function [-Wreturn-type]
215 | }
| ^
|
s288798632 | p03805 | C++ | #include <iostream>
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;
}
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() {
cin.tie(0);
ios::sync_with_stdio(false);
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];
visited[0] = true;
cout << dfs(0, N, visited) << endl;
} | a.cc: In function 'int dfs(int, int, bool*)':
a.cc:21:33: error: expected ';' before ':' token
21 | if (visited[i]) continue:
| ^
| ;
a.cc:21:33: error: expected primary-expression before ':' token
a.cc: In function 'int main()':
a.cc:38:31: error: 'b' was not declared in this scope
38 | int A, B; cin >> A >> b;
| ^
|
s143760022 | p03805 | C++ | #include <iostream>
using namespace std;
const 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() {
cin.tie(0);
ios::sync_with_stdio(false);
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];
visited[0] = true;
cout << dfs(0, N, visited) << endl;
} | a.cc:4:7: error: 'nmax' does not name a type
4 | const nmax = 8;
| ^~~~
a.cc:5:12: error: 'nmax' was not declared in this scope
5 | bool graph[nmax][nmax];
| ^~~~
a.cc:5:18: error: 'nmax' was not declared in this scope
5 | bool graph[nmax][nmax];
| ^~~~
a.cc:7:36: error: 'nmax' was not declared in this scope
7 | int dfs(int v, int N, bool visited[nmax]) {
| ^~~~
a.cc: In function 'int dfs(...)':
a.cc:11:25: error: 'N' was not declared in this scope
11 | for (int i = 0; i < N; i++) {
| ^
a.cc:12:13: error: 'visited' was not declared in this scope; did you mean 'all_visited'?
12 | if (visited[i] == false) all_visited = false;
| ^~~~~~~
| all_visited
a.cc:19:25: error: 'N' was not declared in this scope
19 | for (int i = 0; i < N; i++) {
| ^
a.cc:20:13: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
20 | if (graph[v][i] == false) continue;
| ^~~~~
| isgraph
a.cc:20:19: error: 'v' was not declared in this scope
20 | if (graph[v][i] == false) continue;
| ^
a.cc:21:13: error: 'visited' was not declared in this scope; did you mean 'all_visited'?
21 | if (visited[i]) continue:
| ^~~~~~~
| all_visited
a.cc:21:33: error: expected ';' before ':' token
21 | if (visited[i]) continue:
| ^
| ;
a.cc:21:33: error: expected primary-expression before ':' token
a.cc:24:26: error: 'visited' was not declared in this scope; did you mean 'all_visited'?
24 | ret += dfs(i, N, visited);
| ^~~~~~~
| all_visited
a.cc: In function 'int main()':
a.cc:38:31: error: 'b' was not declared in this scope
38 | int A, B; cin >> A >> b;
| ^
a.cc:39:9: error: 'graph' was not declared in this scope; did you mean 'isgraph'?
39 | graph[A-1][B-1] = graph[B-1][A-1] = true;
| ^~~~~
| isgraph
a.cc:42:18: error: 'nmax' was not declared in this scope
42 | bool visited[nmax];
| ^~~~
a.cc:43:5: error: 'visited' was not declared in this scope
43 | visited[0] = true;
| ^~~~~~~
|
s700404244 | p03805 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
const N_max = 8;
bool node[N_max][N_max];
int DFS(int v, int N){
bool all_visit = true;
for(int i=0; i<N; i++){
if(visit.at(i) == false) all_visit = false;
}
if(all_visit)return 1;
int ans = 0;
for(int i=0; i<N; i++){
if(visit.at(i)) continue;
if(node[v][i] == false) continue;
visit[i] = true;
ans += DFS(i,N,visit);
visit[i] = false;
}
return ans;
}
int main(){
int N,M;
cin >> N >> M;
for(int i=0; i<N; i++){
int a, b;
cin >> a >> b;
node[a][b] = node[b][a] = true;
}
vector <bool>visit(N,false);
visit.at(0)=true;
return 0;
} | a.cc:6:7: error: 'N_max' does not name a type
6 | const N_max = 8;
| ^~~~~
a.cc:7:11: error: 'N_max' was not declared in this scope
7 | bool node[N_max][N_max];
| ^~~~~
a.cc:7:18: error: 'N_max' was not declared in this scope
7 | bool node[N_max][N_max];
| ^~~~~
a.cc: In function 'int DFS(int, int)':
a.cc:12:12: error: 'visit' was not declared in this scope
12 | if(visit.at(i) == false) all_visit = false;
| ^~~~~
a.cc:4:1: note: 'std::visit' is defined in header '<variant>'; this is probably fixable by adding '#include <variant>'
3 | #include <vector>
+++ |+#include <variant>
4 | using namespace std;
a.cc:19:12: error: 'visit' was not declared in this scope
19 | if(visit.at(i)) continue;
| ^~~~~
a.cc:19:12: note: 'std::visit' is defined in header '<variant>'; this is probably fixable by adding '#include <variant>'
a.cc:20:12: error: 'node' was not declared in this scope
20 | if(node[v][i] == false) continue;
| ^~~~
a.cc:22:9: error: 'visit' was not declared in this scope
22 | visit[i] = true;
| ^~~~~
a.cc:22:9: note: 'std::visit' is defined in header '<variant>'; this is probably fixable by adding '#include <variant>'
a.cc: In function 'int main()':
a.cc:36:9: error: 'node' was not declared in this scope
36 | node[a][b] = node[b][a] = true;
| ^~~~
|
s950086426 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> G(N, vector<int>(N));
for (int i = 0; i < M; i++) {
int a, b;
cin >> a >> b;
a--; b--;
G[a][b] = G[b][a] = 1;
}
vector<int> v(N);
for (int i = 0; i < N; i++)
v[i] = i;
int res = 0;
do {
if (v[0] != 0) break;
bool flag = true;
for (int i = 0; i < N - 1; i++) {
if (G[v[i]][v[i + 1]] == 0) {
flag = false;
break;
}
}
if (flag) res++;
} while (next_permutation(v.begin(), v.end()));
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:14: error: 'next_permutation' was not declared in this scope
30 | } while (next_permutation(v.begin(), v.end()));
| ^~~~~~~~~~~~~~~~
|
s077099237 | p03805 | C++ | #include<bits/stdc++.h>
using namespace std;
const int ms = 10;
int visit[ms];
vector<int> g[ms];
int n,m;
int solve(int node, int p){
visit[node] = 1;
bool f = 0;
for(int i = 1;i<=n;i++){
if(!visit[i])
f = 1;
}
if(!f)
return 1;
int ans = 0;
for(auto it : g[node]){
if(it==p)
continue;
if(!visit[it]){
dfs(it,node);
visit[it] = 0;
}
}
return ans;
}
int main(){
int a,b;
cin >> n >> m;
for(int i = 0;i<m;i++){
cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
cout<<dfs(1,-1);
} | a.cc: In function 'int solve(int, int)':
a.cc:9:9: error: reference to 'visit' is ambiguous
9 | visit[node] = 1;
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:1:
/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:4:5: note: 'int visit [10]'
4 | int visit[ms];
| ^~~~~
a.cc:12:13: error: reference to 'visit' is ambiguous
12 | if(!visit[i])
| ^~~~~
/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:4:5: note: 'int visit [10]'
4 | int visit[ms];
| ^~~~~
a.cc:21:21: error: reference to 'visit' is ambiguous
21 | if(!visit[it]){
| ^~~~~
/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:4:5: note: 'int visit [10]'
4 | int visit[ms];
| ^~~~~
a.cc:22:17: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
22 | dfs(it,node);
| ^~~
| ffs
a.cc:23:11: error: reference to 'visit' is ambiguous
23 | visit[it] = 0;
| ^~~~~
/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:4:5: note: 'int visit [10]'
4 | int visit[ms];
| ^~~~~
a.cc: In function 'int main()':
a.cc:40:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
40 | cout<<dfs(1,-1);
| ^~~
| ffs
|
s447783857 | p03805 | C++ | #include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
int n,m;
//接続状況を確認する配列
int connect[n][n];
//既にその頂点を使っているか管理する配列
int visited[n];
int dfs(int now,int depth){
if(visited[now])return 0;
if(depth==n)return 1;
//使用済みフラグを立てる
visited[now]=1;
int ans=0;
//全部の遷移先を調べる
for(int i=0;i<n;i++){
if(connect[now][i]){
ans+=dfs(i,depth+1);
}
}
//使用済みフラグをおる
visited[now]=0;
return ans;
}
int main(){
//int n,m;
cin >>n>>m;
int a[m];
int b[m];
for(int i=0;i<m;i++){
cin >>a[i]>>b[i];
a[i]--;b[i]--;
}
visited[n]={}
connect[n][n]={}
for(int i=0;i<m;i++){
connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
}
cout <<dfs(0,1)<<endl;
}
| a.cc:8:16: error: size of array 'connect' is not an integral constant-expression
8 | int connect[n][n];
| ^
a.cc:8:13: error: size of array 'connect' is not an integral constant-expression
8 | int connect[n][n];
| ^
a.cc:10:13: error: size of array 'visited' is not an integral constant-expression
10 | int visited[n];
| ^
a.cc: In function 'int main()':
a.cc:36:18: error: expected ';' before 'connect'
36 | visited[n]={}
| ^
| ;
37 | connect[n][n]={}
| ~~~~~~~
|
s525018436 | p03805 | C++ | #include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
int n,m;
//接続状況を確認する配列
int connect[n][n];
//既にその頂点を使っているか管理する配列
int visited[n];
int n,m;
int dfs(int now,int depth){
if(visited[now])return 0;
if(depth==n)return 1;
//使用済みフラグを立てる
visited[now]=1;
int ans=0;
//全部の遷移先を調べる
for(int i=0;i<n;i++){
if(connect[now][i]){
ans+=dfs(i,depth+1);
}
}
//使用済みフラグをおる
visited[now]=0;
return ans;
}
int main(){
//int n,m;
cin >>n>>m;
int a[m];
int b[m];
for(int i=0;i<m;i++){
cin >>a[i]>>b[i];
a[i]--;b[i]--;
}
visited[n]={}
connect[n][n]={}
for(int i=0;i<m;i++){
connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
}
cout <<dfs(0,1)<<endl;
}
| a.cc:8:16: error: size of array 'connect' is not an integral constant-expression
8 | int connect[n][n];
| ^
a.cc:8:13: error: size of array 'connect' is not an integral constant-expression
8 | int connect[n][n];
| ^
a.cc:10:13: error: size of array 'visited' is not an integral constant-expression
10 | int visited[n];
| ^
a.cc:11:5: error: redefinition of 'int n'
11 | int n,m;
| ^
a.cc:6:5: note: 'int n' previously declared here
6 | int n,m;
| ^
a.cc:11:7: error: redefinition of 'int m'
11 | int n,m;
| ^
a.cc:6:7: note: 'int m' previously declared here
6 | int n,m;
| ^
a.cc: In function 'int main()':
a.cc:38:18: error: expected ';' before 'connect'
38 | visited[n]={}
| ^
| ;
39 | connect[n][n]={}
| ~~~~~~~
|
s267909791 | p03805 | C++ | #include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
//接続状況を確認する配列
int connect[n][n];
//既にその頂点を使っているか管理する配列
int visited[n];
int n,m;
int dfs(int now,int depth){
if(visited[now])return 0;
if(depth==n)return 1;
//使用済みフラグを立てる
visited[now]=1;
int ans=0;
//全部の遷移先を調べる
for(int i=0;i<n;i++){
if(connect[now][i]){
ans+=dfs(i,depth+1);
}
}
//使用済みフラグをおる
visited[now]=0;
return ans;
}
int main(){
int n,m;
cin >>n>>m;
int a[m];
int b[m];
for(int i=0;i<m;i++){
cin >>a[i]>>b[i];
a[i]--;b[i]--;
}
visited[n]={}
connect[n][n]={}
for(int i=0;i<m;i++){
connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
}
cout <<dfs(0,1)<<endl;
}
| a.cc:7:13: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | int connect[n][n];
| ^
| yn
a.cc:7:16: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | int connect[n][n];
| ^
| yn
a.cc:9:13: error: 'n' was not declared in this scope; did you mean 'yn'?
9 | int visited[n];
| ^
| yn
a.cc: In function 'int dfs(int, int)':
a.cc:13:8: error: 'visited' was not declared in this scope
13 | if(visited[now])return 0;
| ^~~~~~~
a.cc:16:5: error: 'visited' was not declared in this scope
16 | visited[now]=1;
| ^~~~~~~
a.cc:20:12: error: 'connect' was not declared in this scope; did you mean 'const'?
20 | if(connect[now][i]){
| ^~~~~~~
| const
a.cc: In function 'int main()':
a.cc:37:5: error: 'visited' was not declared in this scope
37 | visited[n]={}
| ^~~~~~~
a.cc:40:9: error: 'connect' was not declared in this scope; did you mean 'const'?
40 | connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
| ^~~~~~~
| const
|
s380219234 | p03805 | C++ | #include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
//接続状況を確認する配列
int connect[n][n];
//既にその頂点を使っているか管理する配列
int visited[n];
int n,m;
int dfs(nit now,int depth){
if(visited[now])return 0;
if(depth==n)return 1;
//使用済みフラグを立てる
visited[now]=1;
int ans=0;
//全部の遷移先を調べる
for(int i=0;i<n;i++){
if(connect[now][i]){
ans+=dfs(i,depth+1);
}
}
//使用済みフラグをおる
visited[now]=0;
return ans;
}
int main(){
cin >>n>>m;
int a[m];
int b[m];
for(int i=0;i<m;i++){
cin >>a[i]>>b[i];
a[i]--;b[i]--;
}
visited[n]={}
connect[n][n]={}
for(int i=0;i<m;i++){
connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
}
cout <<dfs(0,1)<<endl;
}
| a.cc:7:13: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | int connect[n][n];
| ^
| yn
a.cc:7:16: error: 'n' was not declared in this scope; did you mean 'yn'?
7 | int connect[n][n];
| ^
| yn
a.cc:9:13: error: 'n' was not declared in this scope; did you mean 'yn'?
9 | int visited[n];
| ^
| yn
a.cc:12:9: error: 'nit' was not declared in this scope; did you mean 'int'?
12 | int dfs(nit now,int depth){
| ^~~
| int
a.cc:12:17: error: expected primary-expression before 'int'
12 | int dfs(nit now,int depth){
| ^~~
a.cc:12:26: error: expression list treated as compound expression in initializer [-fpermissive]
12 | int dfs(nit now,int depth){
| ^
a.cc: In function 'int main()':
a.cc:36:5: error: 'visited' was not declared in this scope
36 | visited[n]={}
| ^~~~~~~
a.cc:39:9: error: 'connect' was not declared in this scope; did you mean 'const'?
39 | connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
| ^~~~~~~
| const
a.cc:42:15: error: 'dfs' cannot be used as a function
42 | cout <<dfs(0,1)<<endl;
| ~~~^~~~~
|
s623717015 | p03805 | C++ | #include<bits/stdc++.h>
#include<vector>
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
}
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 dfs(int, int, bool*)':
a.cc:10:30: error: expected ';' before '}' token
10 | all_visited=false
| ^
| ;
11 | }
| ~
a.cc:25:16: error: a function-definition is not allowed here before '{' token
25 | int main (void){
| ^
a.cc:42:2: error: expected '}' at end of input
42 | }
| ^
a.cc:6:40: note: to match this '{'
6 | int dfs(int v,int N,bool visited[nmax]){
| ^
a.cc:42:2: warning: control reaches end of non-void function [-Wreturn-type]
42 | }
| ^
|
s504808957 | p03805 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
//vector<int> used;
//vector<int> connect;
int N,M;
int dfs(int now,int depth){
if(used[now])return 0;
if(depth==N)return 1;
used[now]=1;
int ans=0;
for(int i=0;i<N;i++){
if(connect[now][i])ans+=dfs(i,depth+1);
}
used[now]=0;
return ans;
}
int main() {
cin >>N>>M;
//vector a(M),b(M);
int a[M];
int b[M];
for(int i=0;i<M;i++){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
}
//used=vector(N,0);
int used[N]={};//N個の配列に0を代入する
//connect=vector(N,vector(N,0));
int connect[N][N]={};
for(int i=0;i<M;i++){
connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
}
cout<<dfs(0,1)<<endl;
}
| a.cc: In function 'int dfs(int, int)':
a.cc:10:7: error: 'used' was not declared in this scope
10 | if(used[now])return 0;
| ^~~~
a.cc:12:4: error: 'used' was not declared in this scope
12 | used[now]=1;
| ^~~~
a.cc:15:10: error: 'connect' was not declared in this scope; did you mean 'const'?
15 | if(connect[now][i])ans+=dfs(i,depth+1);
| ^~~~~~~
| const
|
s625502345 | p03805 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int used[10000];
int connect[10000][10000];
//vector<int> used;
//vector<int> connect;
int N,M;
int dfs(int now,int depth){
if(used[now])return 0;
if(depth==N)return 1;
used[now]=1;
int ans=0;
for(int i=0;i<N;i++){
if(connect[now][i])ans+=dfs(i,depth+1);
}
used[now]=0;
return ans;
}
int main() {
cin >>N>>M;
//vector a(M),b(M);
int a[M];
int b[M];
for(int i=0;i<M;i++){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
}
//used=vector(N,0);
int used[N]={}//N個の配列に0を代入する
//connect=vector(N,vector(N,0));
int connect[N][N]={};
for(int i=0;i<M;i++){
connect[a[i]][b[i]]=connect[b[i]][a[i]]=1;
}
cout<<dfs(0,1)<<endl;
}
| a.cc: In function 'int main()':
a.cc:34:4: error: expected ',' or ';' before 'int'
34 | int connect[N][N]={};
| ^~~
|
s370347637 | p03805 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int used[10000];
int connect[10000][10000];
//vector<int> used;
//vector<int> connect;
int N,M;
int dfs(int now,int depth){
if(used[now])return 0;
if(depth==N)return 1;
used[now]=1;
int ans=0;
for(int i=0;i<N;i++){
if(connect[now][i])ans+=dfs(i,depth+1);
}
used[now]=0;
return ans;
}
int main() {
cin >>N>>M;
//vector a(M),b(M);
int a[M];
int b[M];
for(int i=0;i<M;i++){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
}
//used=vector(N,0);
int used[N]={}//N個の配列に0を代入する
//connect=vector(N,vector(N,0));
int connect[N][N]={}
for(int i=0,i<M;i++){
connect[a[i]b[i]]=connect[b[i]a[i]]=1;
}
cout<<dfs(0,1)<<endl;
}
| a.cc: In function 'int main()':
a.cc:34:4: error: expected ',' or ';' before 'int'
34 | int connect[N][N]={}
| ^~~
a.cc:35:17: error: expected ';' before '<' token
35 | for(int i=0,i<M;i++){
| ^
| ;
a.cc:35:17: error: expected primary-expression before '<' token
a.cc:36:19: error: expected ']' before 'b'
36 | connect[a[i]b[i]]=connect[b[i]a[i]]=1;
| ^
| ]
a.cc:36:19: error: expected ';' before 'b'
36 | connect[a[i]b[i]]=connect[b[i]a[i]]=1;
| ^
| ;
|
s214202040 | p03805 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int used[10000];
int connect[10000][10000];
//vector<int> used;
//vector<int> connect;
int N,M;
int dfs(int now,int depth){
if(used[now])return 0;
if(depth==N)return 1;
used[now]=1;
int ans=0;
for(int i=0;i<N;i++){
if(connect[now][i])ans+=dfs(i,depth+1);
}
used[now]=0;
return ans;
}
int main() {
cin >>N>>M;
//vector a(M),b(M);
int a[M];
int b[M];
for(int i=0,i<M;i++){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
}
used=vector(N,0);
connect=vector(N,vector(N,0));
for(int i=0,i<M;i++){
connect[a[i]b[i]]=connect[b[i]a[i]]=1;
}
cout<<dfs(0,1)<<endl;
}
| a.cc: In function 'int main()':
a.cc:27:17: error: expected ';' before '<' token
27 | for(int i=0,i<M;i++){
| ^
| ;
a.cc:27:17: error: expected primary-expression before '<' token
a.cc:31:8: error: incompatible types in assignment of 'std::vector<int>' to 'int [10000]'
31 | used=vector(N,0);
| ~~~~^~~~~~~~~~~~
a.cc:32:11: error: incompatible types in assignment of 'std::vector<std::vector<int>, std::allocator<std::vector<int> > >' to 'int [10000][10000]'
32 | connect=vector(N,vector(N,0));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:33:17: error: expected ';' before '<' token
33 | for(int i=0,i<M;i++){
| ^
| ;
a.cc:33:17: error: expected primary-expression before '<' token
a.cc:34:19: error: expected ']' before 'b'
34 | connect[a[i]b[i]]=connect[b[i]a[i]]=1;
| ^
| ]
a.cc:34:19: error: expected ';' before 'b'
34 | connect[a[i]b[i]]=connect[b[i]a[i]]=1;
| ^
| ;
|
s981149279 | p03805 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<int> used;
vector<int> connect;
int N,M;
int dfs(int now,int depth){
if(used[now])return 0;
if(depth==N)return 1;
used[now]=1;
int ans=0;
for(int i=0;i<N;i++){
if(connect[now][i])ans+=dfs(i,depth+1);
}
used[now]=0;
return ans;
}
int main() {
cin >>N>>M;
vector a(M),b(M);
for(int i=0,i<M;i++){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
}
used=vector(N,0);
connect=vector(N,vector(N,0));
for(int i=0,i<M;i++){
connect[a[i]b[i]]=connect[b[i]a[i]]=1;
}
cout<<dfs(0,1)<<endl;
}
| a.cc: In function 'int dfs(int, int)':
a.cc:15:22: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
15 | if(connect[now][i])ans+=dfs(i,depth+1);
| ^
a.cc: In function 'int main()':
a.cc:22:14: error: class template argument deduction failed:
22 | vector a(M),b(M);
| ^
a.cc:22:14: error: no matching function for call to 'vector(int&)'
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:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: couldn't deduce template parameter '_Tp'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: couldn't deduce template parameter '_Tp'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: template argument deduction/substitution failed:
a.cc:22:14: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>'
2033 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate expects 2 arguments, 1 provided
a.cc:22:19: error: class template argument deduction failed:
22 | vector a(M),b(M);
| ^
a.cc:22:19: error: no matching function for call to 'vector(int&)'
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: template argument deduction/substitution failed:
a.cc:22:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: template argument deduction/substitution failed:
a.cc:22:19: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: template argument deduction/substitution failed:
a.cc:22:19: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
56 |
s689231940 | p03805 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector used;
vector connect;
int N,M;
int dfs(int now,int depth){
if(used[now])return 0;
if(depth==N)return 1;
used[now]=1;
int ans=0;
for(int i=0;i<N;i++){
if(connect[now][i])ans+=dfs(i,depth+1);
}
used[now]=0;
return ans;
}
int main() {
cin >>N>>M;
vector a(M),b(M);
for(int i=0,i<M;i++){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
}
used=vector(N,0);
connect=vector(N,vector(N,0));
for(int i=0,i<M;i++){
connect[a[i]b[i]]=connect[b[i]a[i]]=1;
}
cout<<dfs(0,1)<<endl;
}
| a.cc:6:8: error: class template argument deduction failed:
6 | vector used;
| ^~~~
a.cc:6:8: error: no matching function for call to 'vector()'
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:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: template argument deduction/substitution failed:
a.cc:6:8: note: couldn't deduce template parameter '_Tp'
6 | vector used;
| ^~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>'
2033 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate expects 2 arguments, 0 provided
a.cc:7:8: error: class template argument deduction failed:
7 | vector connect;
| ^~~~~~~
a.cc:7:8: error: no matching function for call to 'vector()'
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: template argument deduction/substitution failed:
a.cc:7:8: note: couldn't deduce template parameter '_Tp'
7 | vector connect;
| ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
428 | cla |
s109692902 | p03805 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector connect;
int N,M;
int dfs(int now,int depth){
if(used[now])return 0;
if(depth==N)return 1;
used[now]=1;
int ans=0;
for(int i=0;i<N;i++){
if(connect[now][i])ans+=dfs(i,depth+1);
}
used[now]=0;
return ans;
}
int main() {
cin >>N>>M;
vector a(M),b(M);
for(int i=0,i<M;i++){
cin>>a[i]>>b[i];
a[i]--;b[i]--;
}
used=vector(N,0);
connect=vector(N,vector(N,0));
for(int i=0,i<M;i++){
connect[a[i]b[i]]=connect[b[i]a[i]]=1;
}
cout<<dfs(0,1)<<endl;
}
| a.cc:7:8: error: class template argument deduction failed:
7 | vector connect;
| ^~~~~~~
a.cc:7:8: error: no matching function for call to 'vector()'
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:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: template argument deduction/substitution failed:
a.cc:7:8: note: couldn't deduce template parameter '_Tp'
7 | vector connect;
| ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>'
2033 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate expects 2 arguments, 0 provided
a.cc: In function 'int dfs(int, int)':
a.cc:10:7: error: 'used' was not declared in this scope
10 | if(used[now])return 0;
| ^~~~
a.cc:12:4: error: 'used' was not declared in this scope
12 | used[now]=1;
| ^~~~
a.cc: In function 'int main()':
a.cc:22:14: error: class template argument deduction failed:
22 | vector a(M),b(M);
| ^
a.cc:22:14: error: no matching function for call to 'vector(int&)'
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: mismatched types 'std::vector<_Tp, _Alloc>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: template argument deduction/substitution failed:
a.cc:22:14: note: couldn't deduce template parameter '_Tp'
22 | vector a(M),b(M);
| ^
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'temp |
s093729082 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
int dfs(vector<vector<int>>&a,vector<int>b,int i,int n){
int counter=0;
for(int k;k<n+1;k++){
counter+=b.at(k);
}
if(b.at(i)==0){
b.at(i)=1;
int sum=0;
for(int j=0;j<a.at(i).size();j++){
sum+=dfs(a,b,a.at(i).at(j));
}
return sum;
}
else if(b.at(i)==1&&counter==n){
return 1;
}
else return 0;
}
int main(){
int n,m;
cin>>n>>m;
vector<int> a(m);
vector<int> b(m);
for(int i=0;i<m;i++){
cin>>a.at(i)>>b.at(i);
}
vector<vector<int>> c(n+1);
for(int i=0;i<m;i++){
c.at(a.at(i)).push_back(b.at(i));
c.at(b.at(i)).push_back(a.at(i));
}
vector<int> f(n+1);
cout<<dfs(c,f,1,n)<<endl;
} | a.cc: In function 'int dfs(std::vector<std::vector<int> >&, std::vector<int>, int, int)':
a.cc:12:15: error: too few arguments to function 'int dfs(std::vector<std::vector<int> >&, std::vector<int>, int, int)'
12 | sum+=dfs(a,b,a.at(i).at(j));
| ~~~^~~~~~~~~~~~~~~~~~~
a.cc:3:5: note: declared here
3 | int dfs(vector<vector<int>>&a,vector<int>b,int i,int n){
| ^~~
|
s797815499 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
int dfs(vector<vector<int>>&a,vector<int>b,int i,int n){
if(b.at(i)==0){
b.at(i)=1;
int sum=0;
for(int j=0;j<a.at(i).size();j++){
sum+=dfs(a,f,a.at(i).at(j));
}
return sum;
}
int counter=0;
for(int k;k<n+1;k++){
counter+=b.at(k);
}
else if(b.at(i)==1&&counter==n){
return 1;
}
else return 0;
}
int main(){
int n,m;
cin>>n>>m;
vector<int> a(m);
vector<int> b(m);
for(int i=0;i<m;i++){
cin>>a.at(i)>>b.at(i);
}
vector<vector<int>> c(n+1);
for(int i=0;i<m;i++){
c.at(a.at(i)).push_back(b.at(i));
c.at(b.at(i)).push_back(a.at(i));
}
vector<int> f(n+1);
cout<<dfs(c,f,1,n)<<endl;
} | a.cc: In function 'int dfs(std::vector<std::vector<int> >&, std::vector<int>, int, int)':
a.cc:8:18: error: 'f' was not declared in this scope
8 | sum+=dfs(a,f,a.at(i).at(j));
| ^
a.cc:16:3: error: 'else' without a previous 'if'
16 | else if(b.at(i)==1&&counter==n){
| ^~~~
|
s808717564 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
int main(){
int n,m;
cin>>n>>m;
int edge[n][n];
memset(edge,0,sizeof(edge));
rep(i,m){
int a,b;
cin>>a>>b;
edge[a-1][b-1]=1;
edge[b-1][a-1]=1;
}
vector<int> a(n);
rep(i,n)a[i]=i;
int ans=0;
int combi=1;
rep(i,1,n+1)combi*=i;
rep(i,combi){
bool flag=1;
rep(j,n-1){
if(!edge[a[j]][a[j+1]]){
flag=0;
break;
}
}
if(flag)++ans;
next_permutation(a.first(),a.last());
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:37:28: error: 'class std::vector<int>' has no member named 'first'
37 | next_permutation(a.first(),a.last());
| ^~~~~
a.cc:37:38: error: 'class std::vector<int>' has no member named 'last'; did you mean 'at'?
37 | next_permutation(a.first(),a.last());
| ^~~~
| at
|
s250010641 | p03805 | C++ | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int> > edges;
bool isValid(vector<int> v){
if(v[0] != 1)
return false;
for(int i = 0; i< v.size()-1; i++){
if(!edges[v[i]][v[i+1]]){
return false;
}
}
return true;
}
int main() {
int n,m; cin >> n >> m;
vector<int> edge(n);
vector<int> v;
for(int i = 0;i<n;i++){
v.push_back(i);
edges.push_back(edge);
for(int j = 0; j< n;j++){
edges[i][j] = 0;
}
}
int from,to;
for(int i = 0; i< m;i++){
cin >> from >> to;
edges[from-1][to-1] = 1;
edges[to-1][from-1] = 1;
}
int count = 0;
do {
if(isValid(v)){
count++;
}
} while(next_permutation(v.begin(), v.end()));
cout << count << endl;
}
| a.cc: In function 'int main()':
a.cc:41:13: error: 'next_permutation' was not declared in this scope
41 | } while(next_permutation(v.begin(), v.end()));
| ^~~~~~~~~~~~~~~~
|
s078115690 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>>g;
vector<bool> visited;
int n,m;
void add_edge(int a,int b){
g[a].push_back(b);
g[b].push_back(a);
}
int dfs(int i,int dpt){
int ret=0;
if(dpt==n)return 1;
for(auto&& w:g[i]){
visited[i]=true;
if(!visited[w])ret+=dfs(w,++dpt);
visited[i]=false;
}
return ret;
}
int main(){
cin>>n>>m;
g.resize(n);
visited.assign(n,false);
for(int i=0;i<m;i++){
int a,b;cin>>a>>b;
add_edge(--a,--b);
}
cout<<dfs(0,1)<<endl;
} | a.cc:19:1: error: extended character is not valid in an identifier
19 | visited[i]=false;
| ^
a.cc:19:1: error: extended character is not valid in an identifier
a.cc: In function 'int dfs(int, int)':
a.cc:19:1: error: '\U00003000\U00003000visited' was not declared in this scope
19 | visited[i]=false;
| ^~~~~~~~~~~
|
s993088910 | p03805 | C++ | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>>g;
vector<bool> visited;
int n,m;
void add_edge(int a,int b){
g[a].push_back(b);
g[b].push_back(a);
}
int dfs(int i,int dpt){
int ret=0;
if(dpt==n)return 1;
visited[i]=true;
for(auto&& w:g[i]){
if(!visited[w])ret+=dfs(w,++dpt);
visited[i]=false;
}
return ret;
}
int main(){
cin>>n>>m;
g.resize(n);
visited.assign(n,false);
for(int i=0;i<m;i++){
int a,b;cin>>a>>b;
add_edge(--a,--b);
}
cout<<dfs(0,1)<<endl;
} | a.cc:18:1: error: extended character is not valid in an identifier
18 | visited[i]=false;
| ^
a.cc:18:1: error: extended character is not valid in an identifier
a.cc: In function 'int dfs(int, int)':
a.cc:18:1: error: '\U00003000\U00003000visited' was not declared in this scope
18 | visited[i]=false;
| ^~~~~~~~~~~
|
s624377069 | p03805 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define REP(i,n) for(i=0;i<n;i++)
int iin() {
int i;
scanf("%d", &i);
return i;
}
long long llin() {
long long i;
scanf("%lld", &i);
return i;
}
double din() {
double i;
scanf("%lf", &i);
return i;
}
char cin() {
char c;
scanf("%c", &c);
return c;
}
void stin(char *s) {
scanf("%s", s);
}
void iout(int i) {
printf("%d\n", i);
}
void llout(long long i) {
printf("%lld\n", i);
}
void dout(double i) {
printf("%lf\n", i);
}
void cout(char c) {
printf("%c\n", c);
}
void stout(char *s) {
printf("%s\n", s);
}
int dfs(int v, int n, int **table, int *visited) {
int all_visited = 1, i;
REP(i,n) {
if (!visited[i]) {
all_visited = 0;
break;
}
}
if (all_visited) {
return 1;
}
int count = 0;
REP(i,n) {
if (!table[v][i]) continue;
if (visited[i]) continue;
visited[i] = 1;
count += dfs(i, n, table, visited);
visited[i] = 0;
}
return count;
}
int main() {
int n = iin(), m = iin(), i, a, b;
int table[n][n];
memset(table, 0, sizeof table);
REP(i,m) {
a = iin();
b = iin();
table[a - 1][b - 1] = 1;
table[b - 1][a - 1] = 1;
}
int visited[N];
memset(visited, 0, sizeof visited);
int count = dfs(0, n, table, visited);
iout(count);
return 0;
}
| main.c: In function 'main':
main.c:95:17: error: 'N' undeclared (first use in this function)
95 | int visited[N];
| ^
main.c:95:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:97:27: error: passing argument 3 of 'dfs' from incompatible pointer type [-Wincompatible-pointer-types]
97 | int count = dfs(0, n, table, visited);
| ^~~~~
| |
| int (*)[n]
main.c:57:29: note: expected 'int **' but argument is of type 'int (*)[n]'
57 | int dfs(int v, int n, int **table, int *visited) {
| ~~~~~~^~~~~
|
s531315380 | p03805 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define REP(i,n) for(i=0;i<n;i++)
int iin() {
int i;
scanf("%d", &i);
return i;
}
long long llin() {
long long i;
scanf("%lld", &i);
return i;
}
double din() {
double i;
scanf("%lf", &i);
return i;
}
char cin() {
char c;
scanf("%c", &c);
return c;
}
void stin(char *s) {
scanf("%s", s);
}
void iout(int i) {
printf("%d\n", i);
}
void llout(long long i) {
printf("%lld\n", i);
}
void dout(double i) {
printf("%lf\n", i);
}
void cout(char c) {
printf("%c\n", c);
}
void stout(char *s) {
printf("%s\n", s);
}
int dfs(int v, int n, int **table, int *visited) {
int all_visited = 1, i;
REP(i,n) {
if (!visited[i]) {
all_visited = 0;
break;
}
}
if (all_visited) {
return 1;
}
int count = 0;
REP(i,n) {
if (!table[v][i]) continue;
if (visited[i]) continue;
visited[i] = 1;
count += dfs(i, n, table, visited);
visited[i] = 0;
}
return count;
}
int main() {
int n = iin(), m = iin(), i, a, b;
int table[N][N];
memset(table, 0, sizeof table);
REP(i,m) {
a = iin();
b = iin();
table[a - 1][b - 1] = 1;
table[b - 1][a - 1] = 1;
}
int visited[N];
memset(visited, 0, sizeof visited);
int count = dfs(0, n, table, visited);
iout(count);
return 0;
}
| main.c: In function 'main':
main.c:87:15: error: 'N' undeclared (first use in this function)
87 | int table[N][N];
| ^
main.c:87:15: note: each undeclared identifier is reported only once for each function it appears in
|
s234510336 | p03805 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define REP(i,n) for(i=0;i<n;i++)
int iin() {
int i;
scanf("%d", &i);
return i;
}
long long llin() {
long long i;
scanf("%lld", &i);
return i;
}
double din() {
double i;
scanf("%lf", &i);
return i;
}
char cin() {
char c;
scanf("%c", &c);
return c;
}
void stin(char *s) {
scanf("%s", s);
}
void iout(int i) {
printf("%d\n", i);
}
void llout(long long i) {
printf("%lld\n", i);
}
void dout(double i) {
printf("%lf\n", i);
}
void cout(char c) {
printf("%c\n", c);
}
void stout(char *s) {
printf("%s\n", s);
}
int dfs(int v, int n, int **table, int *visited) {
int all_visited = 1, i;
REP(i,n) {
if (!visited[i]) {
all_visited = 0;
break;
}
}
if (all_visited) {
return 1;
}
int count = 0;
REP(i,n) {
if (!table[v][i]) continue;
if (visited[i]) continue;
visited[i] = true;
count += dfs(i, n, table, visited);
visited[i] = false;
}
return count;
}
int main() {
int n = iin(), m = iin(), i, a, b;
int table[N][N];
memset(table, 0, sizeof table);
REP(i,m) {
a = iin();
b = iin();
table[a - 1][b - 1] = 1;
table[b - 1][a - 1] = 1;
}
int visited[N];
memset(visited, 0, sizeof visited);
int count = dfs(0, n, table, visited);
iout(count);
return 0;
}
| main.c: In function 'dfs':
main.c:77:22: error: 'true' undeclared (first use in this function)
77 | visited[i] = true;
| ^~~~
main.c:6:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
5 | #include <limits.h>
+++ |+#include <stdbool.h>
6 |
main.c:77:22: note: each undeclared identifier is reported only once for each function it appears in
77 | visited[i] = true;
| ^~~~
main.c:79:22: error: 'false' undeclared (first use in this function)
79 | visited[i] = false;
| ^~~~~
main.c:79:22: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'main':
main.c:87:15: error: 'N' undeclared (first use in this function)
87 | int table[N][N];
| ^
|
s936044415 | p03805 | C++ | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> int former(const vector<T> &v, T x){
return upper_bound(v.begin(),v.end(),x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x){
return lower_bound(v.begin(),v.end(),x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<29;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) { }
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0) return x;
else return par[x] = root(par[x]);
}
bool issame(ll x, ll y) {
return root(x) == root(y);
}
bool merge(ll x, ll y) {
x = root(x); y = root(y);
if (x == y) return false;
if (par[x] > par[y]) swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) {
return -par[root(x)];
}
};
template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n=G.size();
vector<T> d(n,INF);
vector<int> b(n,-1);
priority_queue<P,vector<P>,greater<P> > q;
d[s]=0;
q.emplace(d[s],s);
while(!q.empty()){
P p=q.top();q.pop();
int v=p.second;
if(d[v]<p.first) continue;
for(auto& e:G[v]){
int u=e.first;
T c=e.second;
if(d[u]>d[v]+c){
d[u]=d[v]+c;
b[u]=v;
q.emplace(d[u],u);
}
}
}
return d;
}
const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int nmax = 8;
bool graph[nmax][nmax];
int main(){
cin >> n >> m;
vector<int> v(n-1);
iota(all(v),2);
int ans = 0;
bool flag = true;
rep(i,m){
int a,b;
cin >> a >> b;
graph[a][b] = graph[b][a] = true;
}
do {
int start = 1;
flag = true;
for(int i = 0; i < v.size(); ++i){
if(!graph[start][v[i]]){
flag = false;
break;
}
start = v[i];
}
if(flag) ++ans;
} while( next_permutation(v.begin(), v.end()) );
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:126:10: error: 'n' was not declared in this scope; did you mean 'yn'?
126 | cin >> n >> m;
| ^
| yn
a.cc:126:15: error: 'm' was not declared in this scope; did you mean 'tm'?
126 | cin >> n >> m;
| ^
| tm
|
s207892717 | p03805 | C | #include <stdio.h>
void DFS(int now, int *ans, int n, int visited[], int cango[][n]);
int main(void)
{
int n,m,i,j,ans=0,now=0;
scanf("%d%d", &n,&m);
int a[m], b[m],cango[n][n], visited[n];
for(i=0; i<m; i++) scanf("%d%d", &a[i], &b[i]);
for(i=0; i<n; i++)
{
for(j=0; j<n; j++) cango[i][j]=0;
visited[i]=0;
}
for(i=0; i<m; i++)
{
cango[a[i]-1][b[i]-1]=1;
cango[b[i]-1][a[i]-1]=1;
}
visited[0]=1;
DFS(now, &ans, n, visited[], cango[][]);
printf("%d", ans);
return 0;
}
void DFS(int now, int *ans, int n, int visited[], int cango[][n])//nが頂点数
{
int i,flag=1,temp[n];
for(i=0; i<n; i++) temp[i]=visited[i];//tempがvisitedになる
for(i=0; i<n; i++)
{
if(temp[i]==0) flag=0;
}
if(flag==1) *ans++;
else
{
for(i=0; i<n; i++)
{
if(temp[i]==0 && cango[now][i]==1)
{
temp[i]=1;
DFS(i, ans, n, temp[], cango[][]);
temp[i]=0;
}
}
}
} | main.c: In function 'main':
main.c:20:31: error: expected expression before ']' token
20 | DFS(now, &ans, n, visited[], cango[][]);
| ^
main.c: In function 'DFS':
main.c:41:37: error: expected expression before ']' token
41 | DFS(i, ans, n, temp[], cango[][]);
| ^
|
s492491931 | p03805 | C++ | #include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()
const int nmax=8;
bool graph[nmax][nmax];
int dfs(int v, int n, bool visited[nmax]) {
bool all_visited = true;
REP(i, n) {
if(visited[i] == false) {
all_visited = false;
}
}
if(all_visited) {
return 1;
}
int ret = 0;
REP(i, n) {
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() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,m;
cin >> n >> m;
REP(i, m) {
int a,b;
cin >> a >> b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
}
bool visited[nmax];
REP(i, n) {
visited[i] = true;
}
visited[0] = true;
cout << dfs(0, n, visited) << endl;
return 0;
}
| a.cc: In function 'int dfs(int, int, bool*)':
a.cc:41:19: error: 'N' was not declared in this scope
41 | ret += dfs(i, N, visited);
| ^
|
s271219947 | p03805 | C++ | #include<iostream>
#include <fstream>
#include <vector>
using namespace std;
int counter = 0;
void findP(vector<int> points);
int n, m;
vector<pair<int, int>> edge;
int main()
{
#ifdef LOCAL
std::ifstream in("input.txt");
std::cin.rdbuf(in.rdbuf());
#endif
cin >> n >> m;
for(int i=0;i<m;i++){
int p1, p2;
cin >> p1 >> p2;
edge.push_back({p1, p2});
}
vector<int> points = {1};
findP(points);
cout << counter << endl;
return 0;
}
void findP(vector<int> points){
if(points.size() >= n){
counter++;
}
else{
for(auto iter:edge){
vector<int> tmpPoint = points;
if(iter.first == tmpPoint[points.size()-1] && std::count(tmpPoint.begin(), tmpPoint.end(), iter.second) == 0){
tmpPoint.push_back(iter.second);
findP(tmpPoint);
}
else if(iter.second == tmpPoint[points.size()-1] && std::count(tmpPoint.begin(), tmpPoint.end(), iter.first) == 0){
tmpPoint.push_back(iter.first);
findP(tmpPoint);
}
}
}
} | a.cc: In function 'void findP(std::vector<int>)':
a.cc:40:64: error: 'count' is not a member of 'std'; did you mean 'cout'?
40 | if(iter.first == tmpPoint[points.size()-1] && std::count(tmpPoint.begin(), tmpPoint.end(), iter.second) == 0){
| ^~~~~
| cout
a.cc:44:70: error: 'count' is not a member of 'std'; did you mean 'cout'?
44 | else if(iter.second == tmpPoint[points.size()-1] && std::count(tmpPoint.begin(), tmpPoint.end(), iter.first) == 0){
| ^~~~~
| cout
|
s860624217 | p03805 | C++ | #include <cstdio>
#include <vector>
using namespace std;
const int MAX_N = 8, MAX_M = MAX_N * (MAX_N - 1) / 2;
int N, M, a[MAX_M], b[MAX_M];
vector<int> graph[MAX_N];
bool used[MAX_N];
int dfs(int n) {
used[n] = true;
bool end = true;
for (int i = 0; i < N; i++) {
end &= used[i];
}
if (end) {
used[n] = false;
return 1;
}
int res = 0;
for (int i = 0; i < graph[n].size(); i++) {
if (!used[graph[n][i]]) {
res += dfs(graph[n][i]);
}
}
used[n] = false;
return res;
}
void solve() {
for (int i = 0; i < M; i++) {
graph[a[i] - 1].push_back(b[i] - 1);
graph[b[i] - 1].push_back(a[i] - 1);
}
memset(used, false, sizeof(used));
int res = dfs(0);
printf("%d\n", res);
}
int main() {
scanf("%d %d", &N, &M);
for (int i = 0; i < M; i++) {
scanf("%d %d", &a[i], &b[i]);
}
solve();
} | a.cc: In function 'void solve()':
a.cc:41:9: error: 'memset' was not declared in this scope
41 | memset(used, false, sizeof(used));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <vector>
+++ |+#include <cstring>
3 | using namespace std;
|
s792915980 | p03805 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> p(n);
iota(p.begin(), p.end(), 0);
int g[11][11];
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
x--, y--;
g[x][y] = g[y][x] = 1;
}
int ans = 0;
do {
bool f = true;
if (p[0])
break;
for (int i = 1; i < n; i++) {
if (g[p[i - 1]][p[i]] == 0)
f = false;
}
if (f)
ans++;
} while (next_permutation(p.begin(), p.end()));
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:5: error: 'iota' was not declared in this scope
10 | iota(p.begin(), p.end(), 0);
| ^~~~
|
s134575434 | p03805 | C++ | #include<bits/stdc++.h>
#include <utility>
using namespace std;
typedef long long ll;
bool graph[8][8];
int dfs(int v, int N, bool visited[8]){
bool all_visited = true;
for (int i = 0;i < n;i++){
if (visited[i]==false) all_visited = false;
}
if (all_visited = true) return 1;
int ret;
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;
}
}
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[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:9:28: error: 'n' was not declared in this scope
9 | for (int i = 0;i < n;i++){
| ^
a.cc:15:24: error: 'n' was not declared in this scope
15 | for (int i=0;i<n;i++){
| ^
a.cc:22:1: warning: control reaches end of non-void function [-Wreturn-type]
22 | }
| ^
|
s641677144 | p03805 | C++ | #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<int> par, rank;
UnionFind(int n) : par(n , -1), rank(n, 0) { }
void init(int n) { par.assign(n, -1), rank.assign(n, 0); }
int root(int x) {
if (par[x] == -1) return x;
else return par[x] = root(par[x]);
}
bool issame(int x, int y) {
return root(x) == root(y);
}
bool merge(int x, int y) {
x = root(x); y = root(y);
if (x == y) return false;
if (rank[x] < rank[y]) swap(x, y);
if (rank[x] == rank[y]) ++rank[x];
par[y] = x;
return true;
}
};
const int nmax = 8;
bool graph[nmax][nmax];
void dfs(int v, int N, bool visited[nmax]){
bool all_visited = true;
rep(i,N){
if(visited[i]==false)
all_visited = false;
}
if(all_visited) return 1;
int ret=0;
rep(i,N){
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;
rep(i,M) {
int a,b;
cin >> a >> b;
graph[a-1][b-1] = graph[b-1][a-1] = true;
}
bool visited[nmax];
rep(i,N) visited[i]=false;
visited[0] = true;
cout << dfs(0,N,visited) << endl;
} | a.cc: In function 'void dfs(int, int, bool*)':
a.cc:83:26: error: return-statement with a value, in function returning 'void' [-fpermissive]
83 | if(all_visited) return 1;
| ^
a.cc:92:15: error: void value not ignored as it ought to be
92 | ret += dfs(i,N,visited);
| ~~~^~~~~~~~~~~~~
a.cc:95:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
95 | return ret;
| ^~~
a.cc: In function 'int main()':
a.cc:111:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'void')
111 | cout << dfs(0,N,visited) << endl;
| ~~~~ ^~ ~~~~~~~~~~~~~~~~
| | |
| | void
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'void' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'void' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'void' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'void' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'void' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'void' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'void' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'void' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'void' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'void' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'void' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'void' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'void' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'void' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'void' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'void' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char |
s959477880 | p03805 | C++ | #include <iostream>
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;
}
if (all_visited){
return 1;
}
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 x, y;
cin >> x >> y;
graph[x-1][y-1] = graph[y-1][x-1] = true;
}
bool visited[nmax]();
visited[0] = true;
cout << dfs(0, N, vidited) << endl;
return 0;
} | a.cc: In function 'int dfs(int, int, bool*)':
a.cc:19:3: error: 'ret' was not declared in this scope
19 | ret = 0;
| ^~~
a.cc: In function 'int main()':
a.cc:43:8: error: declaration of 'visited' as array of functions
43 | bool visited[nmax]();
| ^~~~~~~
a.cc:45:3: error: 'visited' was not declared in this scope
45 | visited[0] = true;
| ^~~~~~~
a.cc:46:21: error: 'vidited' was not declared in this scope
46 | cout << dfs(0, N, vidited) << endl;
| ^~~~~~~
|
s878202593 | p03805 | C++ | #include <iostream>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int a[50], b[50];
int e[10][10];
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
e[i][j] = 0;
}
}
for(int i = 0; i < m; i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
e[a[i]][b[i]]++;
e[b[i]][a[i]]++;
}
int ans = 0;
int seq[10];
for(int i = 0; i < n; i++){
seq[i] = i;
}
do{
bool f = true;
for(int i = 0; i < n - 1; i++){
if(e[seq[i]][seq[i + 1]] == 0){
f = false;
}
}
if(f){
ans++;
}
}
while(next_permutation(seq + 1, seq + n));
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:38:11: error: 'next_permutation' was not declared in this scope
38 | while(next_permutation(seq + 1, seq + n));
| ^~~~~~~~~~~~~~~~
|
s295276560 | p03805 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
int cnt=0;
int N,M;
bool e[8][8]={false};
int dfs(int v,int N,bool c[8]){
bool all = true;
for(int i=0;i<N;i++){
if(!c[i]) all=false;
}
if(all) return 1;
int ret=0;
for(int i=0;i<N;i++){
//今見ている頂点とつながっていれば探索
if(e[v][i]==false) continue;
//すでに訪れていたら探索しない
if(cc[i]) continue;
//探す
c[i]=true;
ret+=dfs(i,N,c);
c[i]=false;
}
return ret;
}
int main(){
cin >> N >> M;
for(int i=0;i<M;i++){
int a,b; cin >> a >> b;
e[a-1][b-1]=true;
a[b-1][a-1]=true;
}
bool vv[8];
for(int i=0;i<N;i++) vv[i] = true;
vv[0]=true;
cout << dfs(0,N,vv) << endl;
return 0;
}
| a.cc: In function 'int dfs(int, int, bool*)':
a.cc:29:12: error: 'cc' was not declared in this scope; did you mean 'c'?
29 | if(cc[i]) continue;
| ^~
| c
a.cc: In function 'int main()':
a.cc:43:10: error: invalid types 'int[int]' for array subscript
43 | a[b-1][a-1]=true;
| ^
|
s490313711 | p03805 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
using namespace std;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef pair<int,int> pint;
typedef vector<pint> vping;
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0,};
int N,M, cnt;
bool tree[8][8];
bool vst[8];
rep(i,8) vst[i]=false;
void dfs(int v, int num){
if(num == N){
cnt++;return;
}
vst[v] = true;
rep(i,N){
if(tree[v][i] && !vst[i]){
dfs(i, num+1);
}
}
}
int main() {
cin >> N >> M;
rep(i,M){
int a,b;
cin >> a >> b;
a--;b--;
tree[a][b] = true;
tree[b][a] = true;
}
dfs(0,1);
cout << cnt << endl;
}
| a.cc:22:18: error: expected unqualified-id before 'for'
22 | #define rep(i,n) for(int i=0;i<n;i++)
| ^~~
a.cc:35:1: note: in expansion of macro 'rep'
35 | rep(i,8) vst[i]=false;
| ^~~
a.cc:35:5: error: 'i' does not name a type
35 | rep(i,8) vst[i]=false;
| ^
a.cc:22:30: note: in definition of macro 'rep'
22 | #define rep(i,n) for(int i=0;i<n;i++)
| ^
a.cc:35:5: error: 'i' does not name a type
35 | rep(i,8) vst[i]=false;
| ^
a.cc:22:34: note: in definition of macro 'rep'
22 | #define rep(i,n) for(int i=0;i<n;i++)
| ^
|
s421040530 | p03805 | C++ | #include <iostream>
using namespace std;
constexpr int MAX_N = 8;
int ab[MAX_N+1][MAX_N+1];
int idx[]{1,2,3,4,5,6,7,8};
int main() {
int N, M;
cin >> N >> M;
for (int i{}; i < M; ++i) {
int a, b;
cin >> a >> b;
ab[a][b] = ab[b][a] = true;
}
int ans{};
sort(idx, idx + N); // 昇順にソートしておく必要あり
do {
bool path{true};
for (int i{1}; i < N; ++i) {
if (!ab[idx[i-1]][idx[i]]) {
path = false;
break;
}
}
if (path)
++ans;
} while (next_permutation(idx+1, idx + N));
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'?
17 | sort(idx, idx + N); // 昇順にソートしておく必要あり
| ^~~~
| short
a.cc:28:12: error: 'next_permutation' was not declared in this scope
28 | } while (next_permutation(idx+1, idx + N));
| ^~~~~~~~~~~~~~~~
|
s025697756 | p03805 | C++ | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
vector<vector<bool>> graph(8, vector<bool>(8));
int DFS(int x,int N,vector<bool> visited){
bool allvisited=true;
for(int i=0;i<N;i++){
if(visited(i) == false){
allvisited=false;
}
if(allvisited){
return 1;
}
}
int sum = 0;
for(int i=0; i<N;i++){
if(graph.at(x).at(i)==false) continue;
if(visited.at(i)==false) continue;
visited.at(i) = true;
sum+=DFS(i,N,visited);
visited.at(i) = false;
}
return sum;
}
int main(void){
int N,M;
cin >> N >> M;
for(int i=0;i<M;i++){
int A,B;
cin >> A >> B;
graph.at(A-1).at(B-1)=graph.at(B-1).at(A-1)=true;
}
vector<bool> visited(8, true);
for(int i=1;i<N;i++){
visited.at(i)=false;
}
cout << DFS(0, N, visited) << endl;
} | a.cc: In function 'int DFS(int, int, std::vector<bool>)':
a.cc:10:15: error: no match for call to '(std::vector<bool>) (int&)'
10 | if(visited(i) == false){
| ~~~~~~~^~~
|
s686127653 | p03805 | C++ | #include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;
using graph = vector<vector<int>>;
int main() {
int n, m; cin >> n >> m;
vector<int> a(m), b(m);
graph g(n);
REP(i, m){
cin >> a[i] >> b[i];
--a[i]; --b[i];
g[a[i]].emplace_back(b[i]);
}
function<int(int, vector<bool>)> rec = [&](int s, vector<bool> vis){
if(find(vis.begin(), vis.end(), false) == vis.end()) return 1;
int ret = 0;
for(const auto& next: g[s]){
vector<bool> nv = vis;
nv[s] = true;
ret += rec(next, nv);
}
return ret;
}
cout << rec(0, vector<bool>(n, false)) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:35:3: error: expected ',' or ';' before 'cout'
35 | cout << rec(0, vector<bool>(n, false)) << endl;
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.