submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s574949946
p03634
C++
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <functional> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF 1<<29 #define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0])) #define MP make_pair #define mp make_pair #define pb push_back #define PB push_back #define _DEBUG(x) cout<<#x<<": "<<x<<endl #define _DDEBUG(x,y) cout<<#x<<": "<<x<<", "<<#y<<": "<<y<<endl #define ll long long #define ull unsigned long long #define MOD 1000000007 const int max_v = 100010; const ll infinite = 1000'0000'0000'0000; ll cost[max_v][max_v]; // e=(u,v) cost, if not exists, INF ll d[max_v]; // distance bool used[max_v]; // flag int V; // vertex count void dijkstra(int s) { fill(d, d + V, infinite); fill(used, used + V, false); d[s] = 0; while(true) { int v = -1; // find minimum distance not used vertex for(int u = 0; u < V; u++) { if(!used[u] && (v == -1 || d[u] < d[v])) { v = u; } } if(v == -1) { break; } used[v] = true; for(int u = 0; u < V; u++) { d[u] = min(d[u], d[v] + cost[v][u]); } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); cout.precision(16); int n; cin >> n; for(int i = 0; i <= n; i++) { fill(cost[i], cost[i] + max_v, infinite); } int a, b, c; for(int i = 0; i < n - 1; i++) { cin >> a >> b >> c; cost[a][b] = c; cost[b][a] = c; } int q, k; cin >> q >> k; V = n + 1; dijkstra(k); int x, y; for(int i = 0; i < q; i++) { cin >> x >> y; #if DEBUG cout << "** RESULT **" << endl; // debug _DDEBUG(x, y); _DDEBUG(d[x], d[y]); #endif cout << d[x] + d[y] << endl; } return 0; }
/tmp/ccT3Ti7c.o: in function `dijkstra(int)': a.cc:(.text+0xd): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0x44): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0x4d): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0x62): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0x7e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0xdf): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccT3Ti7c.o a.cc:(.text+0xf8): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s696766548
p03634
C++
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <functional> using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF 1<<29 #define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0])) #define MP make_pair #define mp make_pair #define pb push_back #define PB push_back #define _DEBUG(x) cout<<#x<<": "<<x<<endl #define _DDEBUG(x,y) cout<<#x<<": "<<x<<", "<<#y<<": "<<y<<endl #define ll long long #define ull unsigned long long #define MOD 1000000007 const int max_v = 100010; const ll infinite = 1000'0000'0000'0000; ll cost[max_v][max_v]; // e=(u,v) cost, if not exists, INF ll d[max_v]; // distance bool used[max_v]; // flag int V; // vertex count void dijkstra(int s) { fill(d, d + V, infinite); fill(used, used + V, false); d[s] = 0; while(true) { int v = -1; // find minimum distance not used vertex for(int u = 0; u < V; u++) { if(!used[u] && (v == -1 || d[u] < d[v])) { v = u; } } if(v == -1) { break; } used[v] = true; for(int u = 0; u < V; u++) { d[u] = min(d[u], d[v] + cost[v][u]); } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); cout.precision(16); int n; cin >> n; for(int i = 0; i <= n; i++) { fill(cost[i], cost[i] + max_v, infinite); } int a, b, c; for(int i = 0; i < n - 1; i++) { cin >> a >> b >> c; cost[a][b] = c; cost[b][a] = c; } int q, k; cin >> q >> k; V = n + 1; dijkstra(k); int x, y; for(int i = 0; i < q; i++) { cin >> x >> y; #if DEBUG cout << "** RESULT **" << endl; // debug _DDEBUG(x, y); _DDEBUG(d[x], d[y]); #endif cout << d[x] + d[y] << endl; } return 0; }
/tmp/ccUWg2PW.o: in function `dijkstra(int)': a.cc:(.text+0xd): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0x44): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0x4d): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0x62): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0x7e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0xdf): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccUWg2PW.o a.cc:(.text+0xf8): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s876551093
p03634
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < n; i++) #define repp(i, m, n) for(int i = m; i < n; i++) #define reps(i, n) for(int i = 1; i <= n; i++) const int INF = 100000000; const double EPS = 1e-10; const int MOD = 1000000007; using namespace std; typedef long long ll; typedef pair<int, int> pai; typedef pair<ll,ll> pal; bool gone[100010]; ll iku[100010]; void dfs(int s) { rep(i, e[s].size()) { int t=e[s][i].first; ll w=(ll) e[s][i].second; if(gone[t]==0) { gone[t]=1; iku[t]=iku[s]+w; dfs(t); } } } int main() { int n; cin >> n; vector<pai> e[100010]; int a, b, c; rep(i, n-1) { cin >> a >> b >> c; e[a].push_back(pai(b, c)); e[b].push_back(pai(a, c)); } int q, k; cin >> q >> k; gone[k]=1; dfs(k); int x, y; rep(i, q) { cin >> x >> y; cout << (iku[x]+iku[y]) << endl; } return 0; }
a.cc: In function 'void dfs(int)': a.cc:18:16: error: 'e' was not declared in this scope 18 | rep(i, e[s].size()) | ^ a.cc:2:37: note: in definition of macro 'rep' 2 | #define rep(i,n) for(int i = 0; i < n; i++) | ^
s031782849
p03634
C++
#include<iostream> #include<vector> using namespace std; int dist[100005]; vector<int> G[100005]; int N,a,b,c,Q,K; int dfs(int nod) { for(auto it:G[nod]) { if(!dist[it.first]) { dist[it.first]=dist[nod]+it.second; dfs(it.first); } } } int main() { cin>>N; for(int i=1;i<N;i++){cin>>a>>b>>c;G[a].push_back({b,c});G[b].push_back({a,c});} cin>>Q>>K; dist[K]=1; dfs(K); while(Q--){cin>>a>>b;cout<<dist[a]+dist[b]-2<<"\n";} }
a.cc: In function 'int dfs(int)': a.cc:11:13: error: request for member 'first' in 'it', which is of non-class type 'int' 11 | if(!dist[it.first]) | ^~~~~ a.cc:13:9: error: request for member 'first' in 'it', which is of non-class type 'int' 13 | dist[it.first]=dist[nod]+it.second; | ^~~~~ a.cc:13:29: error: request for member 'second' in 'it', which is of non-class type 'int' 13 | dist[it.first]=dist[nod]+it.second; | ^~~~~~ a.cc:14:8: error: request for member 'first' in 'it', which is of non-class type 'int' 14 | dfs(it.first); | ^~~~~ a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type] 17 | } | ^ a.cc: In function 'int main()': a.cc:21:49: error: no matching function for call to 'std::vector<int>::push_back(<brace-enclosed initializer list>)' 21 | for(int i=1;i<N;i++){cin>>a>>b>>c;G[a].push_back({b,c});G[b].push_back({a,c});} | ~~~~~~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>::value_type&' {aka 'const int&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::value_type&&' {aka 'int&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:21:71: error: no matching function for call to 'std::vector<int>::push_back(<brace-enclosed initializer list>)' 21 | for(int i=1;i<N;i++){cin>>a>>b>>c;G[a].push_back({b,c});G[b].push_back({a,c});} | ~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>::value_type&' {aka 'const int&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::value_type&&' {aka 'int&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s922898153
p03634
C++
#include <bits/stdc++.h> typedef long long int LL; using namespace std; const int N = 3e5+7; const int MOD = 1e9+7; const int INF = (~(1<<31)); int fre(){ freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); } inline int read(){ int x=0,f=1;char ch=getchar(); for(;ch<'0'||'9'<ch;ch=getchar())if(ch=='-') f=-1; for(;'0'<=ch&&ch<='9';ch=getchar())x=(x<<3)+(x<<1)+ch-'0'; return x*f; } #define lal puts("****"); #define pb push_back #define mp make_pair #define x first #define y second /*****************************************************************/ struct edge{ int to,next,w; }G[N<<1]; int head[N],tot; void add(int u,int v,int w){ G[tot].w=w,G[tot].to=v,G[tot].next=head[u],head[u]=tot++; G[tot].w=w,G[tot].to=u,G[tot].next=head[v],head[v]=tot++; } LL dp[N]; void dfs(int u,int f,LL w){ dp[u]=w; for(int i=head[u],to;i!=-1;i=G[i].next){ to = G[i].to; if(to == f) continue; dfs(to,u,w+G[i].w); } } int n,q,k; int main(){ memset(head,-1,sizeof(head));tot=0; scanf("%d",&n); for(int i=2,u,v,w;i<=n;i++){ scanf("%d %d %d",&u,&v,&w); add(u,v,w); } // lal scanf("%d%d",&q,&k) dfs(k,0,0); for(int i=1;i<=n;i++) printf("%d <--\n", dp[i]); for(int x,y;q--;){ scanf("%d%d",&x,&y); printf("%lld\n", dp[x]+dp[y]); } return 0; }
a.cc: In function 'int fre()': a.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type] 12 | } | ^ a.cc: In function 'int main()': a.cc:59:24: error: expected ';' before 'dfs' 59 | scanf("%d%d",&q,&k) | ^ | ; 60 | dfs(k,0,0); | ~~~
s664092183
p03634
C++
#include<iostream>   using namespace std;     //long long fa[10005],w[10000];   struct edge{ long long to; long long next; long long w; //edge():to(-1),next(-1),w(-1){ }; }e[10005];   long long v[100005],tote=1; long long fa[100005],depth[100005],s[100005]; long long addedge(long long from,long long to,long long weight){ e[tote].next=v[from]; e[tote].to=to; e[tote].w=weight; v[from]=tote; tote++; } long long init(long long root,long long dep){ long long t=v[root]; depth[root]=dep; while(e[t].to==fa[root]) t=e[t].next; while(t){ if(e[t].to!=fa[root]){ fa[e[t].to]=root; s[e[t].to]=s[root]+e[t].w; init(e[t].to,dep+1); } t=e[t].next; } } long long lca(long long a,long long b){ long long p1=a,p2=b; long long j1,j2; if(depth[a]>depth[b]){ j1=a;j2=b; }else j1=b,j2=a; //get to the same depth while(depth[j1]!=depth[j2]){ j1=fa[j1]; } while(j1!=j2){ j1=fa[j1]; j2=fa[j2]; } long long lca=j1; return s[p1]-s[lca]+s[p2]-s[lca]; }     int main(){ cin.tie(0); ios::sync_with_stdio(false); long long n; cin>>n; n--; while(n--){ long long a,b,c; cin>>a>>b>>c; addedge(a,b,c); addedge(b,a,c); }   init(1,0);//root,depth   long long k; cin>>n>>k; while(n--){ long long a,b; cin>>a>>b; cout<<lca(a,k)+lca(b,k)<<endl; } return 0; }
a.cc:2:1: error: extended character   is not valid in an identifier 2 |   | ^ a.cc:5:1: error: extended character   is not valid in an identifier 5 |   | ^ a.cc:6:1: error: extended character   is not valid in an identifier 6 |   | ^ a.cc:8:1: error: extended character   is not valid in an identifier 8 |   | ^ a.cc:16:1: error: extended character   is not valid in an identifier 16 |   | ^ a.cc:58:1: error: extended character   is not valid in an identifier 58 |   | ^ a.cc:59:1: error: extended character   is not valid in an identifier 59 |   | ^ a.cc:73:1: error: extended character   is not valid in an identifier 73 |   | ^ a.cc:75:1: error: extended character   is not valid in an identifier 75 |   | ^ a.cc:2:1: error: '\U000000a0' does not name a type 2 |   | ^ a.cc:5:1: error: '\U000000a0' does not name a type 5 |   | ^ a.cc:15:2: error: 'e' does not name a type 15 | }e[10005]; | ^ a.cc:16:1: error: '\U000000a0' does not name a type 16 |   | ^ a.cc: In function 'long long int addedge(long long int, long long int, long long int)': a.cc:20:9: error: 'e' was not declared in this scope 20 | e[tote].next=v[from]; | ^ a.cc:20:11: error: 'tote' was not declared in this scope; did you mean 'to'? 20 | e[tote].next=v[from]; | ^~~~ | to a.cc:20:22: error: 'v' was not declared in this scope 20 | e[tote].next=v[from]; | ^ a.cc:26:1: warning: no return statement in function returning non-void [-Wreturn-type] 26 | } | ^ a.cc: In function 'long long int init(long long int, long long int)': a.cc:28:21: error: 'v' was not declared in this scope 28 | long long t=v[root]; | ^ a.cc:30:15: error: 'e' was not declared in this scope 30 | while(e[t].to==fa[root]) t=e[t].next; | ^ a.cc:32:20: error: 'e' was not declared in this scope 32 | if(e[t].to!=fa[root]){ | ^ a.cc:37:19: error: 'e' was not declared in this scope 37 | t=e[t].next; | ^ a.cc:39:1: warning: no return statement in function returning non-void [-Wreturn-type] 39 | } | ^ a.cc: At global scope: a.cc:58:1: error: '\U000000a0' does not name a type 58 |   | ^
s783647042
p03634
C++
#include <bits/stdc++.h> #define mem(a) memset(a,0,sizeof(a)) #define N 100010 #define ll long long int using namespace std; ll an[N]; struct Node{ int to; ll cost; }; vector<Node> v[N]; void dfs(int x,int fa){ for(int i=0;i<v[x].size();i++){ if(v[x][i].to==fa) continue; an[v[x][i].to]=an[x]+v[x][i].cost; dfs(v[x][i].to,x); } } int main(){ int n; scanf("%d", &n); int x,y; ll z; for(int i=1;i<n;i++){ scanf("%d%d%lld",&x,&y,&z); v[x].push_back(pair<y,z>); v[y].push_back(pair<x,z>); } int q,t; scanf("%d%d",&q,&t); dfs(t,-1); while(q--){ scanf("%d%d",&x,&y); printf("%lld\n",an[x]+an[y]); } return 0; }
a.cc: In function 'int main()': a.cc:27:28: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair' 27 | v[x].push_back(pair<y,z>); | ^ a.cc:27:28: note: expected a type, got 'y' a.cc:27:28: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair' a.cc:27:28: note: expected a type, got 'z' a.cc:28:28: error: type/value mismatch at argument 1 in template parameter list for 'template<class _T1, class _T2> struct std::pair' 28 | v[y].push_back(pair<x,z>); | ^ a.cc:28:28: note: expected a type, got 'x' a.cc:28:28: error: type/value mismatch at argument 2 in template parameter list for 'template<class _T1, class _T2> struct std::pair' a.cc:28:28: note: expected a type, got 'z'
s026758365
p03634
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=(1e5); vector<int> G[N+5]; vector<ll> C[N+5]; struct Node{ int u; ll d; Node(){} Node(int _u,ll _d){ u = _u; d = _d; } }; bool operator < (const &Node a,const &Node b){ return a.d > b.d; } int n; const ll INF=(1e18); vector<ll> djistra(int source){ vector<ll> ans(n,INF); ans[source-1] = 0; priority_queue<Node> Q; Q.push(Node(source,0)); while(!Q.empty()){ Node p = Q.top(); Q.pop(); int nodo = p.u; int dist = p.d; for(int i=0;i<G[nodo].size();i++){ int v = G[nodo][i]; int w = C[nodo][i]; if(ans[v-1] > dist + w){ ans[v-1] = dist + w; Q.push(Node(v,dist+w)); } } } return ans; } int main(){ cin>>n; int a,b; ll c; for(int i=1;i<n;i++){ cin>>a>>b>>c; G[a].push_back(b); G[b].push_back(a); C[a].push_back(c); C[b].push_back(c); } int q,k;cin>>q>>k; vector<ll> d = djistra(k); while(q--){ cin>>a>>b; cout<<d[a-1]+d[b-1]<<'\n'; } }
a.cc:20:25: error: ISO C++ forbids declaration of 'Node' with no type [-fpermissive] 20 | bool operator < (const &Node a,const &Node b){ | ^~~~ a.cc:20:30: error: expected ',' or '...' before 'a' 20 | bool operator < (const &Node a,const &Node b){ | ^ a.cc:20:6: error: 'bool operator<(const int&)' must have an argument of class or enumerated type 20 | bool operator < (const &Node a,const &Node b){ | ^~~~~~~~ In file included from /usr/include/c++/14/string:49, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Node]': /usr/include/c++/14/bits/predefined_ops.h:196:23: required from 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<Node*, std::vector<Node, std::allocator<Node> > >; _Value = Node; _Compare = std::less<Node>]' 196 | { return bool(_M_comp(*__it, __val)); } | ~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:140:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Node*, vector<Node, allocator<Node> > >; _Distance = long int; _Tp = Node; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<Node> >]' 140 | while (__holeIndex > __topIndex && __comp(__first + __parent, __value)) | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:216:23: required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<Node*, vector<Node, allocator<Node> > >; _Compare = less<Node>]' 216 | std::__push_heap(__first, _DistanceType((__last - __first) - 1), | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:747:16: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = Node; _Sequence = std::vector<Node, std::allocator<Node> >; _Compare = std::less<Node>; value_type = Node]' 747 | std::push_heap(c.begin(), c.end(), comp); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:11: required from here 30 | Q.push(Node(source,0)); | ~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const Node' and 'const Node') 405 | { return __x < __y; } | ~~~~^~~~~ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::pair<_T1, _T2>' 405 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::reverse_iterator<_Iterator>' 405 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::reverse_iterator<_Iterator>' 405 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::move_iterator<_IteratorL>' 405 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::move_iterator<_IteratorL>' 405 | { return __x < __y; } | ~~~~^~~~~
s085128922
p03634
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=(1e5); vector<int> G[N+5]; vector<ll> C[N+5]; struct Node{ int u; ll d; Node(){} Node(int _u,ll _d){ u = _u; d = _d; } }; bool comp < (const &Node a,const &Node b){ return a.d > b.d; } int n; const ll INF=(1e18); vector<ll> djistra(int source){ vector<ll> ans(n,INF); ans[source-1] = 0; priority_queue<Node> Q; Q.push(Node(source,0)); while(!Q.empty()){ Node p = Q.front(); Q.pop(); int nodo = p.u; int dist = p.d; for(int i=0;i<G[nodo].size();i++){ int v = G[nodo][i]; int w = C[nodo][i]; if(ans[v-1] > dist + w){ ans[v-1] = dist + w; Q.push(Nodo(v,dist+w)); } } } return ans; } int main(){ cin>>n; int a,b; ll c; for(int i=1;i<n;i++){ cin>>a>>b>>c; G[a].push_back(b); G[b].push_back(a); C[a].push_back(c); C[b].push_back(c); } int q,k;cin>>q>>k; vector<ll> d = djistra(k); while(q--){ cin>>a>>b; cout<<d[a-1]+d[b-1]<<'\n'; } }
a.cc:20:11: error: expected initializer before '<' token 20 | bool comp < (const &Node a,const &Node b){ | ^ a.cc: In function 'std::vector<long long int> djistra(int)': a.cc:32:20: error: 'class std::priority_queue<Node>' has no member named 'front' 32 | Node p = Q.front(); | ^~~~~ a.cc:41:24: error: 'Nodo' was not declared in this scope; did you mean 'nodo'? 41 | Q.push(Nodo(v,dist+w)); | ^~~~ | nodo In file included from /usr/include/c++/14/string:49, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Node]': /usr/include/c++/14/bits/predefined_ops.h:196:23: required from 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<Node*, std::vector<Node, std::allocator<Node> > >; _Value = Node; _Compare = std::less<Node>]' 196 | { return bool(_M_comp(*__it, __val)); } | ~~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:140:48: required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Node*, vector<Node, allocator<Node> > >; _Distance = long int; _Tp = Node; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<Node> >]' 140 | while (__holeIndex > __topIndex && __comp(__first + __parent, __value)) | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:216:23: required from 'void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<Node*, vector<Node, allocator<Node> > >; _Compare = less<Node>]' 216 | std::__push_heap(__first, _DistanceType((__last - __first) - 1), | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 217 | _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:747:16: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = Node; _Sequence = std::vector<Node, std::allocator<Node> >; _Compare = std::less<Node>; value_type = Node]' 747 | std::push_heap(c.begin(), c.end(), comp); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:11: required from here 30 | Q.push(Node(source,0)); | ~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_function.h:405:20: error: no match for 'operator<' (operand types are 'const Node' and 'const Node') 405 | { return __x < __y; } | ~~~~^~~~~ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::pair<_T1, _T2>' 405 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::reverse_iterator<_Iterator>' 405 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::reverse_iterator<_Iterator>' 405 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::move_iterator<_IteratorL>' 405 | { return __x < __y; } | ~~~~^~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_function.h:405:20: note: 'const Node' is not derived from 'const std::move_iterator<_IteratorL>' 405 | { return __x < __y; } | ~~~~^~~~~
s313356340
p03634
C++
#include <iostream> #include <vector> using namespace std; typedef long long LL; const int N = 1e5 + 1; struct edge { int to, w; }; vector<edge> G[N]; LL d[N]; void dfs(int v, int p) { for (edge id : G[v]) if (id.to != p) { d[id.to] = d[v] + id.w; dfs(id.to, v); } } int main() { int n, a, b, c, q, k; cin >> n; for (int i = 1; i < n; ++i) { cin >> a >> b >> c; G[a].push_bach({b, c}); G[b].push_bach({a, c}); } cin >> q >> k; dfs(k, 0); for (int i = 0; i < q; ++i) { cin >> a >> b; cout << d[a] + d[b] << '\n'; } }
a.cc: In function 'int main()': a.cc:33:14: error: 'class std::vector<edge>' has no member named 'push_bach'; did you mean 'push_back'? 33 | G[a].push_bach({b, c}); | ^~~~~~~~~ | push_back a.cc:34:14: error: 'class std::vector<edge>' has no member named 'push_bach'; did you mean 'push_back'? 34 | G[b].push_bach({a, c}); | ^~~~~~~~~ | push_back
s226312502
p03634
Java
import java.util.*; public class Main { static long[] depth; static ArrayList[] edge; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); edge = new ArrayList[n]; for(int i = 0; i < n; i++) { edge[i] = new ArrayList<Edge>(); } for(int i = 0; i < n - 1; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; long c = sc.nextLong(); Edge e1 = new Edge(b, c); Edge e2 = new Edge(a, c); edge[a].add(e1); edge[b].add(e2); } int Q = sc.nextInt(); int K = sc.nextInt() - 1; dfs(K, -1, 0); for(int i = 0; i < Q; i++) { int x = sc.nextInt() - 1; int y = sc.nextInt() - 1; System.out.println(depth[x] + depth[y]); } } public static void dfs(int v, int parent, long depth) { depth[v] = depth; ArrayList<Edge> elist = edge[v]; for(int i = 0; i < elist.size(); i++) { Edge e = elist.get(i); if(e.to != parent) dfs(e.to, v, e.cost + depth[v]); } } } class Edge { int to; long cost; Edge(int to, long cost) { this.to = to; this.cost = cost; } }
Main.java:34: error: array required, but long found depth[v] = depth; ^ Main.java:38: error: array required, but long found if(e.to != parent) dfs(e.to, v, e.cost + depth[v]); ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
s692934607
p03634
C++
#include<iostream> #include<vector> using ll = long long; const int limit = 100010; using edge = struct{int to; ll cost;}; vector<edge> tree[limit]; ll depth[limit]; void dfs(int v, int p, ll d) { depth[v] = d; for (auto &e : tree[v]) { if (e.to == p) continue; dfs(e.to, v, d + e.cost); } } int main(void) { int n; cin >> n; for (int i = 0; i < n - 1; ++i) { int a, b, c; cin >> a >> b >> c; a--, b--; tree[a].push_back({b, c}); tree[b].push_back({a, c}); } int q, k; cin >> q >> k; k--; dfs(k, -1, 0); for (int i = 0; i < q; ++i) { int x, y; cin >> x >> y; x--, y--; cout << depth[x] + depth[y] << endl; } return 0; }
a.cc:7:1: error: 'vector' does not name a type 7 | vector<edge> tree[limit]; | ^~~~~~ a.cc: In function 'void dfs(int, int, ll)': a.cc:12:24: error: 'tree' was not declared in this scope; did you mean 'free'? 12 | for (auto &e : tree[v]) { | ^~~~ | free a.cc: In function 'int main()': a.cc:20:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 20 | cin >> n; | ^~~ | 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:26:17: error: 'tree' was not declared in this scope; did you mean 'free'? 26 | tree[a].push_back({b, c}); | ^~~~ | free a.cc:39:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 39 | cout << depth[x] + depth[y] << 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:39:48: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 39 | cout << depth[x] + depth[y] << 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) | ^~~~
s400943003
p03634
C++
using ll = long long; const int limit = 100010; using edge = struct{int to; ll cost;}; vector<edge> tree[limit]; ll depth[limit]; void dfs(int v, int p, ll d) { depth[v] = d; for (auto &e : tree[v]) { if (e.to == p) continue; dfs(e.to, v, d + e.cost); } } int main(void) { int n; cin >> n; for (int i = 0; i < n - 1; ++i) { int a, b, c; cin >> a >> b >> c; a--, b--; tree[a].push_back({b, c}); tree[b].push_back({a, c}); } int q, k; cin >> q >> k; k--; dfs(k, -1, 0); for (int i = 0; i < q; ++i) { int x, y; cin >> x >> y; x--, y--; cout << depth[x] + depth[y] << endl; } return 0; }
a.cc:4:1: error: 'vector' does not name a type 4 | vector<edge> tree[limit]; | ^~~~~~ a.cc: In function 'void dfs(int, int, ll)': a.cc:9:24: error: 'tree' was not declared in this scope 9 | for (auto &e : tree[v]) { | ^~~~ a.cc: In function 'int main()': a.cc:17:9: error: 'cin' was not declared in this scope 17 | cin >> n; | ^~~ a.cc:23:17: error: 'tree' was not declared in this scope 23 | tree[a].push_back({b, c}); | ^~~~ a.cc:36:17: error: 'cout' was not declared in this scope 36 | cout << depth[x] + depth[y] << endl; | ^~~~ a.cc:36:48: error: 'endl' was not declared in this scope 36 | cout << depth[x] + depth[y] << endl; | ^~~~
s650113722
p03634
C++
using ll = long long; cons int limit = 100010; using edge = struct{int to; ll cost;}; vector<edge> tree[limit]; ll depth[limit]; void dfs(int v, int p, ll d) { depth[v] = d; for (auto &e : tree[v]) { if (e.to == p) continue; dfs(e.to, v, d + e.cost); } } int main(void) { int n; cin >> n; for (int i = 0; i < n - 1; ++i) { int a, b, c; cin >> a >> b >> c; a--, b--; tree[a].push_back({b, c}); tree[b].push_back({a, c}); } int q, k; cin >> q >> k; k--; dfs(k, -1, 0); for (int i = 0; i < q; ++i) { int x, y; cin >> x >> y; x--, y--; cout << depth[x] + depth[y] << endl; } return 0; }
a.cc:2:1: error: 'cons' does not name a type; did you mean 'const'? 2 | cons int limit = 100010; | ^~~~ | const a.cc:4:1: error: 'vector' does not name a type 4 | vector<edge> tree[limit]; | ^~~~~~ a.cc:5:10: error: 'limit' was not declared in this scope 5 | ll depth[limit]; | ^~~~~ a.cc: In function 'void dfs(int, int, ll)': a.cc:8:9: error: 'depth' was not declared in this scope 8 | depth[v] = d; | ^~~~~ a.cc:9:24: error: 'tree' was not declared in this scope 9 | for (auto &e : tree[v]) { | ^~~~ a.cc: In function 'int main()': a.cc:17:9: error: 'cin' was not declared in this scope 17 | cin >> n; | ^~~ a.cc:23:17: error: 'tree' was not declared in this scope 23 | tree[a].push_back({b, c}); | ^~~~ a.cc:36:17: error: 'cout' was not declared in this scope 36 | cout << depth[x] + depth[y] << endl; | ^~~~ a.cc:36:25: error: 'depth' was not declared in this scope 36 | cout << depth[x] + depth[y] << endl; | ^~~~~ a.cc:36:48: error: 'endl' was not declared in this scope 36 | cout << depth[x] + depth[y] << endl; | ^~~~
s096656348
p03634
C++
// AtCoder Beginner Contest 070 // D - Transit Tree Path #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; typedef pair<ll, int> pli; const int MAX_N = 100000; int N; int Q, K; vector<pii> G[MAX_N + 1]; int d[MAX_N + 1]; void dfs(int v, int dep = 0, int p = -1) { d[v] = dep; for (pii &p : G[v]) { if (p.second == p) { continue; } dfs(p.second, dep + p.first, v); } } int main() { int a, b, c, x, y; cin >> N; for (int i = 0; i < N - 1; i++) { cin >> a >> b >> c; G[a].push_back(pii(c, b)); G[b].push_back(pii(c, a)); } cin >> Q >> K; dfs(K); for (int i = 0; i < Q; i++) { cin >> x >> y; cout << d[x] + d[y] << endl; } return 0; }
a.cc: In function 'void dfs(int, int, int)': a.cc:21:22: error: no match for 'operator==' (operand types are 'int' and 'pii' {aka 'std::pair<int, int>'}) 21 | if (p.second == p) { | ~~~~~~~~ ^~ ~ | | | | int pii {aka std::pair<int, 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:4: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:21:25: note: 'pii' {aka 'std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:21:25: note: 'pii' {aka 'std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and 'int' 21 | if (p.second == p) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 21 | if (p.second == p) { | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 21 | if (p.second == p) { | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::fpos<_StateT>' and 'int' 21 | if (p.second == p) { | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'const std::allocator<_CharT>' and 'int' 21 | if (p.second == p) { | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:21:25: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 21 | if (p.second == p) { | ^ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, |
s966937688
p03634
Java
import java.io.*; import java.util.*; class A { static class Pair { int to; long w; Pair(int t, long wt) { to = t; w = wt; } } static long[] depth; static ArrayList<Pair>[] v; static boolean[] visited; public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); depth = new long[n]; v = new ArrayList[n]; visited = new boolean[n]; for (int i = 0; i < n; i++) v[i] = new ArrayList<>(); for (int i = 0; i < n - 1; i++) { int x = in.nextInt() - 1; int y = in.nextInt() - 1; long w = in.nextLong(); v[x].add(new Pair(y, w)); v[y].add(new Pair(x, w)); } int q = in.nextInt(); int k = in.nextInt() - 1; dfs(k, -1, 0); for (int i = 0; i < q; i++) { int x = in.nextInt() - 1; int y = in.nextInt() - 1; out.println(depth[x] + depth[y]); } out.close(); } static void dfs(int source, int parent, long d) { visited[source] = true; depth[source] = d; for (Pair a : v[source]) { if (!visited[a.to]) { dfs(a.to, source, d + a.w); } } } static class InputReader { BufferedReader br; StringTokenizer st; public InputReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
s810970755
p03634
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; class A { static class Pair { int to; long w; Pair(int t, long wt) { to = t; w = wt; } } static long[] depth; static ArrayList<Pair>[] v; static boolean[] visited; public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); depth = new long[n]; v = new ArrayList[n]; visited = new boolean[n]; for (int i = 0; i < n; i++) v[i] = new ArrayList<>(); for (int i = 0; i < n - 1; i++) { int x = in.nextInt() - 1; int y = in.nextInt() - 1; long w = in.nextLong(); v[x].add(new Pair(y, w)); v[y].add(new Pair(x, w)); } int q = in.nextInt(); int k = in.nextInt() - 1; dfs(k, -1, 0); for (int i = 0; i < q; i++) { int x = in.nextInt() - 1; int y = in.nextInt() - 1; out.println(depth[x] + depth[y]); } out.close(); } private static void dfs(int source, int parent, long d) { visited[source] = true; depth[source] = d; for (Pair a : v[source]) { if (!visited[a.to]) { dfs(a.to, source, d + a.w); } } } static class InputReader { BufferedReader br; StringTokenizer st; public InputReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
s402647801
p03634
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class A { static class Pair { int to; long w; Pair(int t, long wt) { to = t; w = wt; } } static long[] depth; static ArrayList<Pair>[] v; static boolean[] visited; public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); depth = new long[n]; v = new ArrayList[n]; visited = new boolean[n]; for (int i = 0; i < n; i++) v[i] = new ArrayList<>(); for (int i = 0; i < n - 1; i++) { int x = in.nextInt() - 1; int y = in.nextInt() - 1; long w = in.nextLong(); v[x].add(new Pair(y, w)); v[y].add(new Pair(x, w)); } int q = in.nextInt(); int k = in.nextInt() - 1; dfs(k, -1, 0); for (int i = 0; i < q; i++) { int x = in.nextInt() - 1; int y = in.nextInt() - 1; out.println(depth[x] + depth[y]); } out.close(); } private static void dfs(int source, int parent, long d) { visited[source] = true; depth[source] = d; for (Pair a : v[source]) { if (!visited[a.to]) { dfs(a.to, source, d + a.w); } } } static class InputReader { BufferedReader br; StringTokenizer st; public InputReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } }
Main.java:8: error: class A is public, should be declared in a file named A.java public class A { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s008010289
p03634
C++
//# define FLAG ///delet.................................... # include <iostream> # include <cstring> # include <cstdlib> # include <cstdio> # include <string> # include <cmath> # include <ctime> # include <set> # include <map> # include <queue> # include <stack> # include <bitset> # include <vector> # include <fstream> # include <algorithm> using namespace std; # define eps 1e-8 # define pb push_back # define mp make_pair # define pi acos(-1.0) # define bug puts("H"); # define mem(a,b) memset(a,b,sizeof(a)) # define IOS ios::sync_with_stdio(false); # define FO(i,n,a) for(int i=n; i>=a; --i) # define FOR(i,a,n) for(int i=a; i<=n; ++i) # define INF 0x3f3f3f3f # define MOD 1000000007 /// 123456789 //# pragma comment(linker, "/STACK:1024000000,1024000000") typedef unsigned long long ULL; typedef long long LL; inline int Scan(){ int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } ///coding................................... const int MAXM=100005; LL d[MAXM],n; LL ans=1000000000000000; vector<pair<int,int> >G; void dfs(int x, int fa){ for (int i=0; i<G[x].size(); ++i) { int v=G[x][i].first, w=G[x][i].second; if (v==fa) continue; d[v]=d[x]+w; dfs(v,x); } } int main() { IOS; #ifdef FLAG freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); #endif /// FLAG cin>>n; int x, y, step; FOR(i,1,n-1)cin>>x>>y>>step, G[x].pb(mp(y,step)), G[y].pb(mp(x,step)); int q,k,x1,y1; cin>>q>>k; dfs(k,0); while(q--) { cin>>x1>>y1; cout<<d[x1]+d[y1]<<endl; } return 0; }
a.cc: In function 'void dfs(int, int)': a.cc:48:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'size' 48 | for (int i=0; i<G[x].size(); ++i) { | ^~~~ a.cc:49:19: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} and 'int') 49 | int v=G[x][i].first, w=G[x][i].second; | ^ a.cc:51:19: error: 'w' was not declared in this scope 51 | d[v]=d[x]+w; | ^ a.cc: In function 'int main()': a.cc:20:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back' 20 | # define pb push_back | ^~~~~~~~~ a.cc:65:39: note: in expansion of macro 'pb' 65 | FOR(i,1,n-1)cin>>x>>y>>step, G[x].pb(mp(y,step)), G[y].pb(mp(x,step)); | ^~ a.cc:20:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back' 20 | # define pb push_back | ^~~~~~~~~ a.cc:65:60: note: in expansion of macro 'pb' 65 | FOR(i,1,n-1)cin>>x>>y>>step, G[x].pb(mp(y,step)), G[y].pb(mp(x,step)); | ^~
s560193703
p03634
C++
#include<iostream> using namespace std; //long long fa[10005],w[10000]; struct edge{ long long to; long long next; long long w; //edge():to(-1),next(-1),w(-1){ }; }e[10005]; long long v[10005],tote=1; long long fa[10005],depth[10005],s[10005]; long long addedge(long long from,long long to,long long weight){ e[tote].next=v[from]; e[tote].to=to; e[tote].w=weight; v[from]=tote; tote++; } long long init(long long root,long long dep){ long long t=v[root]; depth[root]=dep; while(e[t].to==fa[root]) t=e[t].next; while(t){ if(e[t].to!=fa[root]){ fa[e[t].to]=root; s[e[t].to]=s[root]+e[t].w; init(e[t].to,dep+1); } t=e[t].next; } } long long lca(long long a,long long b){ long long p1=a,p2=b; long long j1,j2; if(depth[a]>depth[b]){ j1=a;j2=b; }else j1=b,j2=a; //get to the same depth while(depth[j1]!=depth[j2]){ j1=fa[j1]; } while(j1!=j2){ j1=fa[j1]; j2=fa[j2]; } long long lca=j1; return s[p1]-s[lca]+s[p2]-s[lca]; } long long main(){ cin.tie(0); ios::sync_with_stdio(false); long long n; cin>>n; n--; while(n--){ long long a,b,c; cin>>a>>b>>c; addedge(a,b,c); addedge(b,a,c); } init(1,0);//root,depth long long k; cin>>n>>k; while(n--){ long long a,b; cin>>a>>b; cout<<lca(a,k)+lca(b,k)<<endl; } return 0; }
a.cc: In function 'long long int addedge(long long int, long long int, long long int)': a.cc:26:1: warning: no return statement in function returning non-void [-Wreturn-type] 26 | } | ^ a.cc: In function 'long long int init(long long int, long long int)': a.cc:39:1: warning: no return statement in function returning non-void [-Wreturn-type] 39 | } | ^ At global scope: cc1plus: error: '::main' must return 'int'
s567183566
p03634
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int a[] = new int[N-1]; int b[] = new int[N-1]; int c[] = new int[N-1]; int Q, K; int i; int s, t; long ans; for(i=0;i<N-1; i++){ a[i] = sc.nextInt()-1; b[i] = sc.nextInt()-1; c[i] = sc.nextInt(); } Q = sc.nextInt(); K = sc.nextInt(); K -= 1; long d[] = new long[N]; int prev[] = new int[N]; Set<Integer> vert = new HashSet<>(); for(i=0;i<N;i++){ vert.add(i); d[i] = -1; prev[i] = -1; } d[K] = 0; while(!(vert.isEmpty())){ long min = -1; int j = -1; for(int v : vert){ if(min == -1 || d[v] < min){ min = d[v]; j = v; } } vert.remove(j); for(i = 0; i<N-1; i++){ if(a[i] == j){ if(d[b[i]] == -1 || d[b[i]] > d[j] + c[i]){ d[b[i]] = d[j] + c[i]; prev[b[i]] = j; } }else if(b[i] == j){ if(d[a[i]] == -1 || d[a[i]] > d[j] + c[i]){ d[a[i]] = d[j] + c[i]; prev[a[i]] = j; } } }
Main.java:55: error: reached end of file while parsing } ^ 1 error
s779213780
p03634
C++
#include<iostream> #include<cstdio> #include<vector> #include<string> #include<functional> #include<queue> #include<algorithm> #include<complex> #include<cstdlib> #include<cctype> #define DBG cout << '!' << endl; #define REP(i,n) for(int i = 0;i < (n);i++) #define PB push_back #define MP make_pair #define FI first #define SE second #define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;} #define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;} #define ALL(v) v.begin(),v.end() using namespace std; typedef long long ll; typedef vector<int> iv; typedef vector<iv> iiv; typedef vector<string> sv; bool _check[n+1]; ll dp[n+1][n+1]; int main() { ll n; cin >> n; REP(i,n+1) { _check[i] = false; } iiv v(n+1); REP(i,n-1) { int a,b,c; cin >> a >> b >> c; v[a].PB(b); v[b].PB(a); dp[a][b] = dp[b][a] = c; } int qq,kk; cin >> qq >> kk; queue<int> q; int now = kk; REP(i,v[kk].size()) { q.push(v[kk][i]); _check[v[kk][i]] = true; } while(!q.empty()) { int tmp = q.front();q.pop(); REP(i,v[tmp].size()) { int ww = v[tmp][i]; if(_check[ww] == false) { dp[now][ww] = dp[ww][now] = dp[now][tmp] + dp[tmp][ww]; q.push(ww); _check[ww] = true; //DBG } } } REP(i,qq) { int aa,bb; cin >> aa >> bb; cout << dp[aa][kk] + dp[kk][bb] << endl; } return 0; }
a.cc:29:13: error: 'n' was not declared in this scope; did you mean 'yn'? 29 | bool _check[n+1]; | ^ | yn a.cc:30:7: error: 'n' was not declared in this scope; did you mean 'yn'? 30 | ll dp[n+1][n+1]; | ^ | yn a.cc:30:12: error: 'n' was not declared in this scope; did you mean 'yn'? 30 | ll dp[n+1][n+1]; | ^ | yn a.cc: In function 'int main()': a.cc:41:17: error: '_check' was not declared in this scope 41 | _check[i] = false; | ^~~~~~ a.cc:53:17: error: 'dp' was not declared in this scope 53 | dp[a][b] = dp[b][a] = c; | ^~ a.cc:65:17: error: '_check' was not declared in this scope 65 | _check[v[kk][i]] = true; | ^~~~~~ a.cc:74:28: error: '_check' was not declared in this scope 74 | if(_check[ww] == false) | ^~~~~~ a.cc:76:33: error: 'dp' was not declared in this scope 76 | dp[now][ww] = dp[ww][now] = dp[now][tmp] + dp[tmp][ww]; | ^~ a.cc:89:25: error: 'dp' was not declared in this scope 89 | cout << dp[aa][kk] + dp[kk][bb] << endl; | ^~
s994853921
p03634
C++
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <xfunctional> typedef long long ll; using namespace std; vector<ll> nodes[100005]; vector<ll> len[100005]; ll di[100005]; ll n, q, k; ll xs[100005]; ll ys[100005]; bool vi[100005]; int main() { cin >> n; for (ll i = 1; i < n; i++) { ll t1, t2, t3; cin >> t1 >> t2 >> t3; nodes[t1].push_back(t2); len[t1].push_back(t3); nodes[t2].push_back(t1); len[t2].push_back(t3); } cin >> q >> k; priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, greater < pair<ll, ll> > > que; que.push(pair<ll, ll>(0, k)); for (int i = 1; i <= n; i++) { di[i] = INT64_MAX; } di[k] = 0; while (que.size()) { pair<ll, ll> p = que.top(); que.pop(); ll v = p.second; ll d = p.first; vi[v] = true; for (int i = 0; i < nodes[v].size(); i++) { di[nodes[v][i]] = min(di[nodes[v][i]], d + len[v][i]); if (vi[nodes[v][i]] == false) que.push(pair<ll, ll>(di[nodes[v][i]], nodes[v][i])); } } for (ll i = 1; i <= q; i++) { cin >> xs[i] >> ys[i]; } for (ll i = 1; i <= q; i++) { cout << 1ll * di[xs[i]] + 1ll * di[ys[i]] << endl; } }
a.cc:5:10: fatal error: xfunctional: No such file or directory 5 | #include <xfunctional> | ^~~~~~~~~~~~~ compilation terminated.
s337995642
p03634
C++
#include<iostream> #include<vector> #include<memory.h> using namespace std; struct s { int u;//记录边的起点 int v;//记录边的终点 long long int w;//记录边的权值 int next;//指向上一条边的编号 }edge[100010]; int head[100100];//表头,head[i]代表起点是i的边的编号 int cnt=0; void add(int u,int v,int w)//向所要连接的表中加入边 { edge[cnt].u=u; edge[cnt].v=v; edge[cnt].w=w; edge[cnt].next=head[u]; head[u]=cnt++; } // long int dis[100001][100001]; int n; long long int dist[100001]; void dijestra(int uu){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=head[uu];i!=-1;i=edge[i].next){ dist[edge[i].v]=edge[i].w; } dist[uu]=0; s[uu]=1; for(int i=2; i<=n; i++){ // cout<<"test"<<endl; long long int mindist = 100000000000000; int u = uu; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=head[u];j!=-1;j=edge[j].next) if((!s[edge[j].v]) ) { if(dist[u] + edge[j].w<dist[edge[j].v]||dist[edge[j].v]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[edge[j].v] = dist[u] + edge[j].w; } // cout<<"test"<<endl; } } return ; } int main(){ while(cin>>n){ memset(head,-1,sizeof(head)); for(int k=0;k<n-1;k++){ int i,j long long int kk; cin>>i>>j>>kk; add(i,j,kk); add(j,i,kk); // dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
a.cc: In function 'int main()': a.cc:62:25: error: expected initializer before 'long' 62 | long long int kk; | ^~~~ a.cc:63:33: error: 'j' was not declared in this scope 63 | cin>>i>>j>>kk; | ^ a.cc:63:36: error: 'kk' was not declared in this scope; did you mean 'k'? 63 | cin>>i>>j>>kk; | ^~ | k
s755456020
p03634
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAX_V 100005 #define int long long #define INF int(1e18-1) struct Edge { int v, cost; Edge() {} Edge(int v, int cost) : v(v), cost(cost) {} }; // g[] : 重み付き有向グラフの隣接リスト, V : 頂点数, s : 始点となる頂点, d[] : sからの最短経路を格納する配列 // 適宜、終点となる頂点(tとする)を引数に入れて、sからtまでの最短コストd[t]を返しても良い void Dijkstra (vector<Edge> g[], int V, int s, int d[]) { priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > que; fill(d, d + V, INF); d[s] = 0; que.push(make_pair(0, s)); // pair(cost, vertex) bool used[MAX_V + 1] = {false}; while (!que.empty()) { pair<int, int> p = que.top(); que.pop(); int v = p.second, size_ = g[v].size(); if (d[v] < p.first) continue; for (int i = 0; i < size_; ++i) { Edge e = g[v][i]; if (d[e.v] > d[v] + e.cost) { d[e.v] = d[v] + e.cost; que.push(make_pair(d[e.v], e.v)); } } } } ll n, u, k, v, l[MAX_V + 1], dk[MAX_V], a, b, c; vector<Edge> g[MAX_V + 1]; // 有向グラフ signed main() { cin >> n; for (int i = 0; i < n-1; ++i) { cin >> a >> b >> c; a--, b--; g[a].push_back(Edge(b, c)); g[b].push_back(Edge(a, c)); } int q, k, x, y; cin >> q >> k; k--; Dijkstra(g, n, k, dk); for (int i = 0; i < q; ++i) { cin >> x >> y; x--, y--; Dijkstra(g, n, x, l); cout << l[k] + dk[y] << endl; } return 0; }
a.cc: In function 'void Dijkstra(std::vector<Edge>*, long long int, long long int, long long int*)': a.cc:8:13: error: expected primary-expression before 'long' 8 | #define int long long | ^~~~ a.cc:9:13: note: in expansion of macro 'int' 9 | #define INF int(1e18-1) | ^~~ a.cc:21:20: note: in expansion of macro 'INF' 21 | fill(d, d + V, INF); | ^~~
s186299003
p03634
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAX_V 100005 #define INF int(1e18-1) #define int long long struct Edge { int v, cost; Edge() {} Edge(int v, int cost) : v(v), cost(cost) {} }; // g[] : 重み付き有向グラフの隣接リスト, V : 頂点数, s : 始点となる頂点, d[] : sからの最短経路を格納する配列 // 適宜、終点となる頂点(tとする)を引数に入れて、sからtまでの最短コストd[t]を返しても良い void Dijkstra (vector<Edge> g[], int V, int s, int d[]) { priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > que; fill(d, d + V, INF); d[s] = 0; que.push(make_pair(0, s)); // pair(cost, vertex) bool used[MAX_V + 1] = {false}; while (!que.empty()) { pair<int, int> p = que.top(); que.pop(); int v = p.second, size_ = g[v].size(); if (d[v] < p.first) continue; for (int i = 0; i < size_; ++i) { Edge e = g[v][i]; if (d[e.v] > d[v] + e.cost) { d[e.v] = d[v] + e.cost; que.push(make_pair(d[e.v], e.v)); } } } } ll n, u, k, v, l[MAX_V + 1], dk[MAX_V], a, b, c; vector<Edge> g[MAX_V + 1]; // 有向グラフ signed main() { cin >> n; for (int i = 0; i < n-1; ++i) { cin >> a >> b >> c; a--, b--; g[a].push_back(Edge(b, c)); g[b].push_back(Edge(a, c)); } int q, k, x, y; cin >> q >> k; k--; Dijkstra(g, n, k, dk); for (int i = 0; i < q; ++i) { cin >> x >> y; x--, y--; Dijkstra(g, n, x, l); cout << l[k] + dk[y] << endl; } return 0; }
a.cc: In function 'void Dijkstra(std::vector<Edge>*, long long int, long long int, long long int*)': a.cc:9:13: error: expected primary-expression before 'long' 9 | #define int long long | ^~~~ a.cc:7:13: note: in expansion of macro 'int' 7 | #define INF int(1e18-1) | ^~~ a.cc:21:20: note: in expansion of macro 'INF' 21 | fill(d, d + V, INF); | ^~~
s887104640
p03634
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAX_V 100005 #define INF int(1e18) #define int long long struct Edge { int v, cost; Edge() {} Edge(int v, int cost) : v(v), cost(cost) {} }; // g[] : 重み付き有向グラフの隣接リスト, V : 頂点数, s : 始点となる頂点, d[] : sからの最短経路を格納する配列 // 適宜、終点となる頂点(tとする)を引数に入れて、sからtまでの最短コストd[t]を返しても良い void Dijkstra (vector<Edge> g[], int V, int s, int d[]) { priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > que; fill(d, d + V, INF); d[s] = 0; que.push(make_pair(0, s)); // pair(cost, vertex) bool used[MAX_V + 1] = {false}; while (!que.empty()) { pair<int, int> p = que.top(); que.pop(); int v = p.second, size_ = g[v].size(); if (d[v] < p.first) continue; for (int i = 0; i < size_; ++i) { Edge e = g[v][i]; if (d[e.v] > d[v] + e.cost) { d[e.v] = d[v] + e.cost; que.push(make_pair(d[e.v], e.v)); } } } } ll n, u, k, v, l[MAX_V + 1], dk[MAX_V], a, b, c; vector<Edge> g[MAX_V + 1]; // 有向グラフ signed main() { cin >> n; for (int i = 0; i < n-1; ++i) { cin >> a >> b >> c; a--, b--; g[a].push_back(Edge(b, c)); g[b].push_back(Edge(a, c)); } int q, k, x, y; cin >> q >> k; k--; Dijkstra(g, n, k, dk); for (int i = 0; i < q; ++i) { cin >> x >> y; x--, y--; Dijkstra(g, n, x, l); cout << l[k] + dk[y] << endl; } return 0; }
a.cc: In function 'void Dijkstra(std::vector<Edge>*, long long int, long long int, long long int*)': a.cc:9:13: error: expected primary-expression before 'long' 9 | #define int long long | ^~~~ a.cc:7:13: note: in expansion of macro 'int' 7 | #define INF int(1e18) | ^~~ a.cc:21:20: note: in expansion of macro 'INF' 21 | fill(d, d + V, INF); | ^~~
s846876811
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long struct edge { int to; int cost; }; // <最短距離, 頂点の番号> using P = pair<int, int>; int V; vector<edge> G[100000]; int d[100000][100000]; int memo[100000]; void dijkstra(int s) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); int v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { cin >> V; for(int i=0; i<V-1; ++i) { int a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/cc6XUtxD.o: in function `dijkstra(long long)': a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6XUtxD.o a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6XUtxD.o a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6XUtxD.o collect2: error: ld returned 1 exit status
s756137133
p03634
C++
Dijkstra(g, n, x, l);
a.cc:1:17: error: expected constructor, destructor, or type conversion before '(' token 1 | Dijkstra(g, n, x, l); | ^
s193422063
p03634
C++
#include <iostream> #include <algorithm> #include <vector> #include <queue> typedef long long ll; using namespace std; int n, q, k; vector<pair<int, int> > g[100010]; ll ans[100010]; bool vis[100010]; int main(){ scanf("%d", &n); for(int i=0; i<n-1; i++){ int a, b, c; scanf("%d%d%d", &a, &b, &c); g[a].pb(make_pair(b,c)); g[b].pb(make_pair(a,c)); } vis[k] = true; ans[k] = 0; queue<int> bfs; bfs.push_back(k); while(bfs.size()){ int x = bfs.front(); bfs.pop(); vis[x] = true; for(auto pp : g[x]){ if(!vis[pp.first]){ ans[pp.first] = ans[x] + pp.second; bfs.push(pp.first); } } } scanf("%d%d", &q, &k); for(int i=0; i<q; i++){ int x, y; scanf("%d%d", &x, &y); printf("%lld\n", ans[x] + ans[y]); } return 0; }
a.cc: In function 'int main()': a.cc:16:14: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb' 16 | g[a].pb(make_pair(b,c)); | ^~ a.cc:17:14: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb' 17 | g[b].pb(make_pair(a,c)); | ^~ a.cc:22:7: error: 'class std::queue<int>' has no member named 'push_back' 22 | bfs.push_back(k); | ^~~~~~~~~
s523271023
p03634
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; #define de(x) cout << #x << "=" << x << endl #define rep(i,a,b) for(int i=a;i<(b);++i) #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define fi first #define se second const ll INF = 2e15; const int maxn = 1e5+5; const int maxm = 1e5+5; struct Edge { int from, to, dist; Edge(int u, int v, int w) : from(u), to(v), dist(w) {} }; vector <Edge> edge; vector <int> G[maxn]; ll d[maxn][maxn]; bool done[maxn]; int N,M; void Init() { rep(i,1,N+1) G[i].clear(); edge.clear(); } void AddEdge(int from, int to, int dist) { int e; edge.pb(Edge(from, to, dist)); e = sz(edge); G[from].pb(e - 1); } void dij(int s) { priority_queue <pii,vector<pii>,greater<pii> > Q; rep(i,1,N+1) { d[s][i] = INF; } d[s][s] = 0; memset(done,0,sizeof(done)); Q.push(mp(0,s)); while (!Q.empty()) { pii t = Q.top(); Q.pop(); int u = t.se; if (done[u]) continue; done[u] = true; rep(i,0,sz(G[u])) { Edge e = edge[G[u][i]]; if (d[s][e.to] > d[s][u] + e.dist) { d[s][e.to] = d[s][u] + e.dist; Q.push(mp(d[s][e.to],e.to)); } } } } int main () { scanf("%d", &N); Init(); rep(i,1,N) { int from, to, w; scanf("%d%d%d", &from, &to, &w); AddEdge(from, to, w); AddEdge(to, from, w); } rep(i,1,N+1) dij(i); int Q,K; scanf("%d%d",&Q,&K); rep(i,0,Q) { int S,T; scanf("%d%d",&S,&T); ll ans = d[S][K] + d[K][T]; //de(K); de(S); de(T); //de(d[S][K]); de(d[K][T]); cout<<ans<<endl; } return 0; }
/tmp/cctZ7Mgk.o: in function `Init()': a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o /tmp/cctZ7Mgk.o: in function `dij(int)': a.cc:(.text+0x13f): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o a.cc:(.text+0x187): relocation truncated to fit: R_X86_64_PC32 against symbol `done' defined in .bss section in /tmp/cctZ7Mgk.o a.cc:(.text+0x1f9): relocation truncated to fit: R_X86_64_PC32 against symbol `done' defined in .bss section in /tmp/cctZ7Mgk.o a.cc:(.text+0x211): relocation truncated to fit: R_X86_64_PC32 against symbol `done' defined in .bss section in /tmp/cctZ7Mgk.o /tmp/cctZ7Mgk.o: in function `main': a.cc:(.text+0x436): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o a.cc:(.text+0x4ac): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o a.cc:(.text+0x4ce): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cctZ7Mgk.o collect2: error: ld returned 1 exit status
s984254086
p03634
C++
#include<iostream> #include<vector> #include<memory.h> using namespace std; //vector<int >qqq[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; void dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=1;i<=n;i++){ if(dis[v][i]!=-1) dist[i]=dis[v][i]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=1;j<=n; j++) if((!s[j]) && dis[u][j]!=-1) { if(dist[u] + dis[u][j]<dist[j]||dist[j]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[j] = dist[u] + dis[u][j]; } } } return ; } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); // for(int i=1;i<=n;i++){ // qqq[i].clear(); // } for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; // qqq[i].push_back(j); // qqq[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
/tmp/ccOBy4uG.o: in function `dijestra(int)': a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0xb9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0x153): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0x195): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0x227): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccOBy4uG.o a.cc:(.text+0x288): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s273301513
p03634
C++
#include<iostream> using namespace std; long calcmini(long x,long K){ long ans=0; if(path[x*N+K]!=0){ return path[x*N+K]; } for(int k=0;k<N;k++){ if(path[x*N+k]!=0){ ans = max(calcmini(k,K)+path[x*N+k],ans); } } return ans; } int main(){ long N,path[20000000300],ans[20000000300]={},a,b,c,Q,K,x,y,ans; cin>>N; for(int i=0;i<N;i++){ cin>>a; cin>>b; cin>>c; path[a*N+b] =c; } cin>>Q; cin>>K; for(int j=0;j<Q;j++){ cin>>x; cin>>y; ans = calcmini(x,K); cout<<ans<<endl; } return 0; }
a.cc: In function 'long int calcmini(long int, long int)': a.cc:7:6: error: 'path' was not declared in this scope 7 | if(path[x*N+K]!=0){ | ^~~~ a.cc:7:13: error: 'N' was not declared in this scope 7 | if(path[x*N+K]!=0){ | ^ a.cc:10:17: error: 'N' was not declared in this scope 10 | for(int k=0;k<N;k++){ | ^ a.cc:11:8: error: 'path' was not declared in this scope 11 | if(path[x*N+k]!=0){ | ^~~~ a.cc: In function 'int main()': a.cc:19:62: error: conflicting declaration 'long int ans' 19 | long N,path[20000000300],ans[20000000300]={},a,b,c,Q,K,x,y,ans; | ^~~ a.cc:19:28: note: previous declaration as 'long int ans [20000000300]' 19 | long N,path[20000000300],ans[20000000300]={},a,b,c,Q,K,x,y,ans; | ^~~ a.cc:34:9: error: incompatible types in assignment of 'long int' to 'long int [20000000300]' 34 | ans = calcmini(x,K); | ~~~~^~~~~~~~~~~~~~~
s092285250
p03634
C++
#include<iostream> #include<vector> #include<memory.h> using namespace std; vector<int >qqq[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; void dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=0;i<qqq[v].size();i++){ dist[qqq[v][i]]=dis[v][qqq[v][i]]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=0;j<qqq[u].size(); j++) if((!s[qqq[u][j]]) && dis[u][qqq[u][j]]!=-1) { if(dist[u] + dis[u][qqq[u][j]]<dist[qqq[u][j]]||dist[qqq[u][j]]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[qqq[u][j]] = dist[u] + dis[u][qqq[u][j]]; } } } return ; } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); for(int i=1;i<=n;i++){ qqq[i].clear(); } for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; qqq[i].push_back(j); qqq[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
/tmp/cc43p7pj.o: in function `dijestra(int)': a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc43p7pj.o a.cc:(.text+0x3fe): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s841667191
p03634
C++
#include<iostream> #include<vector> #include<memory.h> using namespace std; vector<int >qqq[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; void dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=0;i<qqq[v].size();i++){ dist[qqq[v][i]]=dis[v][qqq[v][i]]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=0;j<qqq[u].size(); j++) if((!s[qqq[u][j]]) && dis[u][qqq[u][j]]!=-1) { if(dist[u] + dis[u][qqq[u][j]]<dist[qqq[u][j]]||dist[qqq[u][j]]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[qqq[u][j]] = dist[u] + dis[u][qqq[u][j]]; } } } return ; } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); // for(int i=1;i<=n;i++){ // q[i].clear(); // } for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; qqq[i].push_back(j); qqq[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
/tmp/cc9uRLh0.o: in function `dijestra(int)': a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cc9uRLh0.o a.cc:(.text+0x3fe): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s925575091
p03634
C++
#include<iostream> #include<vector> #include<memory.h> using namespace std; vector<int >q[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; void dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=0;i<q[v].size();i++){ dist[q[v][i]]=dis[v][q[v][i]]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=0;j<q[u].size(); j++) if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1) { if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[q[u][j]] = dist[u] + dis[u][q[u][j]]; } } } return ; } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); // for(int i=1;i<=n;i++){ // q[i].clear(); // } for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; q[i].push_back(j); q[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
/tmp/ccQudCat.o: in function `dijestra(int)': a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccQudCat.o a.cc:(.text+0x3fe): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s864929650
p03634
C++
#include<iostream> #include<iomanip> #include<queue> #include<string> #include<stack> #include<cstdio> #include<cstdlib> #include<cmath> #include<cstring> #include<cassert> #include<ctime> #include<algorithm> #include<utility> #include<map> #include<set> #include<vector> #include<functional> using namespace std; #ifdef DEBUG #define dprintf printf #define dout(x) cout<<#x" = "<<(x)<<endl #define darray(x,n) {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;} #define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++) #define drep(i,n) for(int (i)=0;(i)<(n);(i)++) #define dstop() scanf("%*c") #else #define dprintf (1)?0:printf #define dout(x) #define darray(x,n) #define dloop(i,s,g) if(1){}else #define drep(i,n) if(1){}else #define dstop() if(1){}else #endif #define F first #define S second #define pb push_back #define mp make_pair #define loop(i,s,g) for(int (i)=(s);(i)<(g);(i)++) #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define all(x) (x.begin(),x.end()) #define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__); #define array(T,id,n) T id[n]; rep(i,n)cin>>id[i]; //#define int long long; #ifndef int #define INF (1e9) #else #define INF (0x7fffffffffffffff) #endif #define LINF (0x7fffffffffffffff) typedef long long ll; typedef unsigned ui; typedef unsigned long long ull; typedef pair<int,int> i_i; typedef pair<ll,int> ll_i; typedef pair<ll,ll> ll_ll; typedef pair<double,int> d_i; typedef pair<double,double> d_d; void impl(){}; template <typename T,typename... TS > void impl(T &head,TS &... tail) { cin>>head; impl(tail ...); } #define MAX_V 112345 struct edge { int to; int cost; }; int V; vector<edge> G[MAX_V]; ll d[MAX_V]; void dijkstra(int s) { priority_queue<i_i,vector<i_i>,greater<i_i> > que; fill(d,d+V,LINF); d[s]=0; que.push(i_i(0,s)); while(!que.empty()) { i_i p=que.top(); que.pop(); int v=p.second; if(d[v]<p.first) continue; int n=G[v].size(); rep(i,n) { edge e=G[v][i]; if(d[e.to]>d[v]+e.cost) { d[e.to]=d[v]+e.cost; que.push(i_i(d[e.to],e.to)); } } } } signed main(void) { in(int,n); rep(i,n-1) { in(int,a,b,c); edge temp; temp.to=b-1; temp.cost=c; G[a-1].pb(temp); temp.to=a-1; G[b-1].pb(temp); } dprintf("グラフ\n"); drep(i,n-1) { drep(j,G[i].size()) dprintf("%d %d %d\n",i,G[i][j].to,G[i][j].cost); } in(int,q,k); V=n; dijkstra(k-1); dprintf("ダイクストラ\n"); darray(d,n); rep(i,q) { in(int,x,y); cout<<d[x-1]+d[y-1]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:130:30: error: 'i' was not declared in this scope 130 | dprintf("%d %d %d\n",i,G[i][j].to,G[i][j].cost); | ^ a.cc:130:37: error: 'j' was not declared in this scope 130 | dprintf("%d %d %d\n",i,G[i][j].to,G[i][j].cost); | ^
s099839457
p03634
C++
#include<iostream> #include<queue> #include<memory.h> using namespace std; vector<int >q[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; int dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=0;i<q[v].size();i++){ dist[q[v][i]]=dis[v][q[v][i]]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=0;j<q[u].size(); j++) if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1) { if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[q[u][j]] = dist[u] + dis[u][q[u][j]]; } } } } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); // for(int i=1;i<=n;i++){ // q[i].clear(); // } for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; q[i].push_back(j); q[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
a.cc: In function 'int dijestra(int)': a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type] 36 | } | ^ /tmp/ccAk7uoW.o: in function `dijestra(int)': a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccAk7uoW.o a.cc:(.text+0x3fe): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s845610421
p03634
C++
#include<iostream> #include<queue> #include<memory.h> using namespace std; vector<int >q[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; int dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=0;i<q[v].size();i++){ dist[q[v][i]]=dis[v][q[v][i]]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=0;j<q[u].size(); j++) if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1) { if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[q[u][j]] = dist[u] + dis[u][q[u][j]]; } } } } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); // for(int i=1;i<=n;i++){ // q[i].clear(); // } for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; q[i].push_back(j); q[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
a.cc: In function 'int dijestra(int)': a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type] 36 | } | ^ /tmp/ccTEuF25.o: in function `dijestra(int)': a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/ccTEuF25.o a.cc:(.text+0x3fe): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s008410913
p03634
C++
#include<iostream> #include<queue> #include<memory.h> using namespace std; vector<int >q[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; int dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=0;i<q[v].size();i++){ dist[q[v][i]]=dis[v][q[v][i]]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=0;j<q[u].size(); j++) if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1) { if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[q[u][j]] = dist[u] + dis[u][q[u][j]]; } } } } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); for(int i=1;i<=n;i++){ q[i].clear(); } for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; q[i].push_back(j); q[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
a.cc: In function 'int dijestra(int)': a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type] 36 | } | ^ /tmp/cczOJ0QE.o: in function `dijestra(int)': a.cc:(.text+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x144): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x1b0): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x1ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x1f2): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x204): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x2e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x383): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x3cc): relocation truncated to fit: R_X86_64_PC32 against symbol `dist' defined in .bss section in /tmp/cczOJ0QE.o a.cc:(.text+0x3fe): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s109348727
p03634
C++
#include<iostream> #include<queue> #include<memory.h> using namespace std; vector<int >q[100001]; long long int dis[100001][100001]; int n; long long int dist[100001]; int dijestra(int v){ bool s[100001]; memset(s,0,sizeof(s)); memset(dist,-1,sizeof(dist)); for(int i=0;i<q[v].size();i++){ dist[q[v][i]]=dis[v][q[v][i]]; } dist[v]=0; s[v]=1; for(int i=2; i<=n; i++){ long long int mindist = 100000000000000; int u = v; for(int j=1; j<=n; ++j) if((!s[j]) &&dist[j]!=-1&&dist[j]<mindist) {u = j; mindist = dist[j]; } s[u] = true; for(int j=0;j<q[u].size(); j++) if((!s[q[u][j]]) && dis[u][q[u][j]]!=-1) { if(dist[u] + dis[u][q[u][j]]<dist[q[u][j]]||dist[q[u][j]]==-1) //在通过新加入的u点路径找到离v0点更短的路径 { dist[q[u][j]] = dist[u] + dis[u][q[u][j]]; } } } } int main(){ while(cin>>n){ memset(dis,-1,sizeof(dis)); q.clear(); for(int k=0;k<n-1;k++){ int i,j,kk; cin>>i>>j>>kk; q[i].push_back(j); q[j].push_back(i); dis[i][j]=dis[j][i]=kk; } int mm,nn; cin>>mm>>nn; dijestra(nn); // cout<<" OK"<<endl; for(int i=0;i<mm;i++){ int a,b; cin>>a>>b; cout<<dist[a]+dist[b]<<endl; } } }
a.cc: In function 'int dijestra(int)': a.cc:36:1: warning: no return statement in function returning non-void [-Wreturn-type] 36 | } | ^ a.cc: In function 'int main()': a.cc:40:19: error: request for member 'clear' in 'q', which is of non-class type 'std::vector<int> [100001]' 40 | q.clear(); | ^~~~~
s672605229
p03634
C++
#include <iostream> #include <vector> #include <set> #include <algorithm> #include <list> #include <cstring> #include <map> #include <queue> #include <ctime> #include <set> #include <sstream> #include <unordered_set> #include <unordered_map> #include <cmath> #define pb push_back #define mp make_pair #define ll long long #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ull unsigned long long #define iloop(a,b) for(ll i = a; i < b; ++i) #define jloop(a,b) for(ll j = a; j < b; ++j) #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(),(c).end() #define tr(c,i) for(typeofa((c).begin() i = (c).begin(); i != (c).end(); i++) #define present(c,x) ((c).find(x) != (c).end()) #define cpresent(c,x) (find(all(c),x) != (c).end()) #define p(a) cout << a << "\n"; #define p1(a) cout << a << " "; #define PI 3.141592653589793 #define MOD (ll)(1e9 + 7) using namespace std; static struct IO { char tmp[1 << 10]; // fast input routines char cur; //#define nextChar() (cur = getc_unlocked(stdin)) //#define peekChar() (cur) inline char nextChar() { return cur = getc_unlocked(stdin); } inline char peekChar() { return cur; } inline operator bool() { return peekChar(); } inline static bool isBlank(char c) { return (c < '-' && c); } inline bool skipBlanks() { while (isBlank(nextChar())); return peekChar() != 0; } inline IO& operator >> (char & c) { c = nextChar(); return *this; } inline IO& operator >> (char * buf) { if (skipBlanks()) { if (peekChar()) { *(buf++) = peekChar(); while (!isBlank(nextChar())) *(buf++) = peekChar(); } *(buf++) = 0; } return *this; } inline IO& operator >> (string & s) { if (skipBlanks()) { s.clear(); s += peekChar(); while (!isBlank(nextChar())) s += peekChar(); } return *this; } inline IO& operator >> (double & d) { if ((*this) >> tmp) sscanf(tmp, "%lf", &d); return *this; } #define defineInFor(intType) \ inline IO& operator >>(intType & n) { \ if (skipBlanks()) { \ int sign = +1; \ if (peekChar() == '-') { \ sign = -1; \ n = nextChar() - '0'; \ } else \ n = peekChar() - '0'; \ while (!isBlank(nextChar())) { \ n += n + (n << 3) + peekChar() - 48; \ } \ n *= sign; \ } \ return *this; \ } defineInFor(int) defineInFor(unsigned int) defineInFor(long long) // fast output routines //#define putChar(c) putc_unlocked((c), stdout) inline void putChar(char c) { putc_unlocked(c, stdout); } inline IO& operator << (char c) { putChar(c); return *this; } inline IO& operator << (const char * s) { while (*s) putChar(*s++); return *this; } inline IO& operator << (const string & s) { for (int i = 0; i < (int)s.size(); ++i) putChar(s[i]); return *this; } char * toString(double d) { sprintf(tmp, "%lf%c", d, '\0'); return tmp; } inline IO& operator << (double d) { return (*this) << toString(d); } #define defineOutFor(intType) \ inline char * toString(intType n) { \ char * p = (tmp + 30); \ if (n) { \ bool isNeg = 0; \ if (n < 0) isNeg = 1, n = -n; \ while (n) \ *--p = (n % 10) + '0', n /= 10; \ if (isNeg) *--p = '-'; \ } else *--p = '0'; \ return p; \ } \ inline IO& operator << (intType n) { return (*this) << toString(n); } defineOutFor(int) defineOutFor(long long) #define endl ('\n') #define cout __io__ #define cin __io__ } __io__; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> ii; ll n; vector<pair<ll, ll> > vec[100000]; vector<ll> dist(100000,LLONG_MAX); void shortestPath(ll s) { set<pair<ll, ll> > st; st.insert(mp(0,s)); dist[s] = 0; while(!st.empty()) { pair<ll, ll> p = *(st.begin()); st.erase(st.begin()); ll u = p.second; for(auto i = vec[u].begin(); i != vec[u].end(); ++i) { ll v = (*i).first; ll weight = (*i).second; if(dist[v] > dist[u] + weight) { if(dist[v] != LLONG_MAX) { st.erase(st.find(mp(dist[v], v))); } dist[v] = dist[u] + weight; st.insert(mp(dist[v],v)); } } } } void solve() { cin >> n; ll a,b,c; iloop(0,n-1) { cin >> a >> b >> c; vec[a].pb(mp(b,c)); vec[b].pb(mp(a,c)); } ll q,k; cin >> q >> k; shortestPath(k); iloop(0,q) { cin >> a >> b; p(dist[a] + dist[b]) } } int main() { bool testing = false; // IOS if(testing) { freopen("test.txt","rt",stdin); int start = clock(); solve(); int end = clock(); cout << "time: " << (end - start)/(double)(CLOCKS_PER_SEC)*1000 << " milliseconds\n"; } else { solve(); } }
a.cc:128:24: error: 'LLONG_MAX' was not declared in this scope 128 | vector<ll> dist(100000,LLONG_MAX); | ^~~~~~~~~ a.cc:15:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 14 | #include <cmath> +++ |+#include <climits> 15 | a.cc: In function 'void shortestPath(long long int)': a.cc:146:47: error: 'LLONG_MAX' was not declared in this scope 146 | if(dist[v] != LLONG_MAX) | ^~~~~~~~~ a.cc:146:47: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
s788227894
p03634
C++
n = int(input()) g = [] d = [0] * (n + 1) for i in range(n + 1): g.append([]); for i in range(n - 1): u, v, w = map(int, input().split()) g[u].append([v, w]) g[v].append([u, w]) q, k = map(int, input().split()) def dfs(u, f, w): d[u] = w; for go in g[u]: if go[0] != f: dfs(go[0], u, go[1] + w) dfs(k, k, 0) while q > 0: u, v = map(int, input().split()) print(d[u] + d[v]) q -= 1
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^ a.cc:6:1: error: expected unqualified-id before 'for' 6 | for i in range(n - 1): | ^~~ a.cc:13:5: error: expected unqualified-id before 'for' 13 | for go in g[u]: | ^~~
s837406974
p03634
C++
//code by 27. #include<stdio.h> #include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<math.h> #include<vector> #include<queue> #include<map> #include<stack> #include<fstream> #include<stdlib.h> #include<set> #include<cassert> #include<climits> #include<cmath> #include<memory.h> #include<conio.h> #include<windows.h> #include<ctime> using namespace std; vector<pair<int,int> >vt[100001]; int k; int ypa(int t,int p,int g)//g:rank?rake?rack?deepvalue { if(t==k) { return g; cout<<"!"<<g<<endl; } else { int s=0; for(int i=0;i<vt[t].size();i++) { if(vt[t][i].first!=p) { s+=ypa(vt[t][i].first,t,g+vt[t][i].second); } } return s; } } int main() { int n; cin>>n; int x,y,z; for(int i=2;i<=n;i++) { scanf("%d%d%d",&x,&y,&z); vt[x].push_back(make_pair(y,z)); vt[y].push_back(make_pair(x,z)); } int q; cin>>q>>k; for(int i=1;i<=q;i++) { scanf("%d%d",&x,&y); int s=0; s+=ypa(x,19260817,0); s+=ypa(y,19260817,0); cout<<s<<endl; } return 0; }
a.cc:19:9: fatal error: conio.h: No such file or directory 19 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s914917326
p03634
C++
#include <bits/stdc++.h> using namespace std; const int maxn=100005,inf=1000000000; using namespace std; long long a[maxn][maxn], d[maxn], p[maxn]; int main(){ int k,m,n,t; scanf("%d",&n); for(int i=1; i<=n-1; i++){ int x, y, z; scanf("%d %d %d",&x, &y, &z); a[x][y] = a[y][x] = z; } scanf("%d%d", &m, &t); for(int i=1; i<=n; i++) d[i]=inf; d[t]=0; for(int i=1; i<=n; i++){ int zx = inf; for(int j=1;j<=n;j++) if(!p[j] && d[j]<zx){ zx=d[j]; k=j; } p[k]=1; for(int j=1;j<=n;j++) if(!p[j] && a[k][j]!=0 && d[j]>d[k]+a[k][j]) d[j]=d[k]+a[k][j]; } for(int i=0; i<m; i++){ int x, y; scanf("%d%d", &x, &y); cout << d[x]+d[y] << endl; } return 0; }
/tmp/ccs3FaMU.o: in function `main': a.cc:(.text+0x114): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x191): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x1b3): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x1e0): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x208): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x25a): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x272): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccs3FaMU.o a.cc:(.text+0x2fe): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s914235953
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long struct edge { signed to; signed cost; }; // <最短距離, 頂点の番号> using P = pair<signed, signed>; int d[100000][100000]; int memo[100000]; void dijkstra(int s, signed V, vector<vector<edge> > G) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); signed v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { signed V; cin >> V; vector<vector<edge> > G(V); for(int i=0; i<V-1; ++i) { signed a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k, V, G); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x, V, G); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/cc6b40kd.o: in function `dijkstra(long, int, std::vector<std::vector<edge, std::allocator<edge> >, std::allocator<std::vector<edge, std::allocator<edge> > > >)': a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6b40kd.o a.cc:(.text+0x49): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6b40kd.o a.cc:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/cc6b40kd.o collect2: error: ld returned 1 exit status
s798404446
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long struct edge { signed to; signed cost; }; // <最短距離, 頂点の番号> using P = pair<signed, signed>; vector<vector<edge> > G(100000); int d[100000][100000]; int memo[100000]; void dijkstra(int s, signed V) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); signed v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { signed V; cin >> V; for(int i=0; i<V-1; ++i) { signed a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k, V); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x, V); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/ccvAQcC5.o: in function `dijkstra(long, int)': a.cc:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccvAQcC5.o a.cc:(.text+0x3f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccvAQcC5.o a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccvAQcC5.o collect2: error: ld returned 1 exit status
s895682391
p03634
C++
#include <iostream> #include <cstdio> #define ll long long const int maxn=100000*2+100; ll n,m,i,xx[maxn],yy[maxn],to[maxn],root,x,y,last[maxn],next[maxn],next1[maxn],last1[maxn],to1[maxn],ans[maxn],fa[maxn],v[maxn],z,dis[maxn],from[maxn]; using namespace std; inline void read(ll &k) { ll f=1;char c=getchar();k=0; while (c<'0'||c>'9')c=='-'&&(f=-1),c=getchar(); while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar(); k*=f; } inline ll gf(ll now) { return fa[now]==now?now:fa[now]=gf(fa[now]); } void dfs(ll now) { v[now]=1; for(ll cur=last[now];cur;cur=next[cur]) { if (!v[to[cur]]) { from[to[cur]]=from[now]+dis[cur]; dfs(to[cur]); fa[to[cur]]=now; } } for (ll cur=last1[now];cur;cur=next1[cur]) if (v[to1[cur]])ans[(cur+1)>>1]=gf(to1[cur]); } int main() { read(n); for (i=1;i<n;i++) { read(x);read(y);read(z); to[i*2-1]=y; dis[i*2-1]=z; next[i*2-1]=last[x]; last[x]=i*2-1; to[i*2]=x; dis[i*2]=z; next[i*2]=last[y]; last[y]=i*2; } read(m);read(root); for (i=1;i<=m;i++) { read(x);read(y); xx[i]=x;yy[i]=y; to1[i*2-1]=y; next1[i*2-1]=last1[x]; last1[x]=i*2-1; to1[i*2]=x; next1[i*2]=last1[y]; last1[y]=i*2; } for (i=1;i<=n;i++)fa[i]=i; dfs(root); for (i=1;i<=m;i++) printf("%lld\n",from[xx[i]]+from[yy[i]]); }
a.cc: In function 'void dfs(long long int)': a.cc:21:34: error: reference to 'next' is ambiguous 21 | for(ll cur=last[now];cur;cur=next[cur]) | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:5:57: note: 'long long int next [200100]' 5 | ll n,m,i,xx[maxn],yy[maxn],to[maxn],root,x,y,last[maxn],next[maxn],next1[maxn],last1[maxn],to1[maxn],ans[maxn],fa[maxn],v[maxn],z,dis[maxn],from[maxn]; | ^~~~ a.cc: In function 'int main()': a.cc:41:9: error: reference to 'next' is ambiguous 41 | next[i*2-1]=last[x]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:5:57: note: 'long long int next [200100]' 5 | ll n,m,i,xx[maxn],yy[maxn],to[maxn],root,x,y,last[maxn],next[maxn],next1[maxn],last1[maxn],to1[maxn],ans[maxn],fa[maxn],v[maxn],z,dis[maxn],from[maxn]; | ^~~~ a.cc:45:9: error: reference to 'next' is ambiguous 45 | next[i*2]=last[y]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:5:57: note: 'long long int next [200100]' 5 | ll n,m,i,xx[maxn],yy[maxn],to[maxn],root,x,y,last[maxn],next[maxn],next1[maxn],last1[maxn],to1[maxn],ans[maxn],fa[maxn],v[maxn],z,dis[maxn],from[maxn]; | ^~~~
s222052469
p03634
C++
10 1 2 1000000000 2 3 1000000000 3 4 1000000000 4 5 1000000000 5 6 1000000000 6 7 1000000000 7 8 1000000000 8 9 1000000000 9 10 1000000000 1 1 9 10
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 10 | ^~
s507328191
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long struct edge { signed to; signed cost; }; // <最短距離, 頂点の番号> using P = pair<signed, signed>; vector<edge> G[100000]; int d[100000][100000]; int memo[100000]; void dijkstra(int s, signed V) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); signed v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { signed V; cin >> V; for(int i=0; i<V-1; ++i) { signed a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k, V); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x, V); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/ccnGldcd.o: in function `dijkstra(long, int)': a.cc:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccnGldcd.o a.cc:(.text+0x3f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccnGldcd.o a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccnGldcd.o collect2: error: ld returned 1 exit status
s796363602
p03634
C++
#include<iostream> #include<algorithm> #include<functional> #include <string> #include<cstdio> #include<math.h> #include<stack> #include<queue> #include<cstring> #include<vector> #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define EREP(i,n) for(int i=(n-1);i>=0;--i) #define D(n,retu) REP(i,n){cin>>retu[i];} #define mod 1000000007 #define MIN -93193111451418101 #define INF 931931114518101 using namespace std; typedef long long int ll; template<typename T> void fill_all(T& arr, const T& v) { arr = v; } template<typename T, typename ARR> void fill_all(ARR& arr, const T& v) { for (auto& i : arr) { fill_all(i, v); } } ll combination(ll n) { ll nck[100][100]; nck[0][0] = 1; for (int i = 1; i < 1 + n; i++) { nck[i][0] = nck[i][i] = 1; for (int j = 1; j < i; j++) { nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j]; } } return 0; } ll GCD(ll u, ll v) { while (v != 0) { ll r = u % v; u = v; v = r; } return u; } //------------------変数-----------------------// vector<vector<ll>>G(100001), cost(100001); //-------------------関数----------------------// bool vis[100001] = {}; ll goukei[100001] = {}; ll DFS(ll v, ll atai) { goukei[v] = atai; vis[v] = true; REP(i, G[v].size()) { if (!vis[G[v][i]]) { DFS(G[v][i], atai + cost[v][i]); } } return 0; } int main() { ll n; cin >> n; fill_all(goukei, INF); REP(i, n-1) { ll a, b, c; cin >> a >> b >> c; a--; b--; G[a].push_back(b); G[b].push_back(a); cost[a].push_back(c); cost[b].push_back(c); } ll q, k; cin >> q >> k; k--; goukei[k] = 0; DFS(k, 0); ll cnt = 0; REP(i, q) { ll x, y; cin >> x >> y; x--, y--; cout << goukei[x] + goukei[y] << endl; } return 0; }
a.cc: In instantiation of 'void fill_all(ARR&, const T&) [with T = long int; ARR = long long int]': a.cc:27:32: required from 'void fill_all(ARR&, const T&) [with T = long int; ARR = long long int [100001]]' 27 | for (auto& i : arr) { fill_all(i, v); } | ~~~~~~~~^~~~~~ a.cc:68:10: required from here 68 | fill_all(goukei, INF); | ~~~~~~~~^~~~~~~~~~~~~ a.cc:27:9: error: 'begin' was not declared in this scope; did you mean 'std::begin'? 27 | for (auto& i : arr) { fill_all(i, v); } | ^~~ | std::begin In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here 114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept; | ^~~~~ a.cc:27:9: error: 'end' was not declared in this scope; did you mean 'std::end'? 27 | for (auto& i : arr) { fill_all(i, v); } | ^~~ | std::end /usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here 116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept; | ^~~
s368339653
p03634
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; #define N 100010 #define M 25 int tot; ll __pow[M]; int head[N]; struct edge{ int u,v,w,next; }e[2*N]; int ver[2*N],R[2*N],first[N];long long dir[N]; int dp[2*N][30]; bool vis[N]; inline void add(int u , int v ,int w ,int &k) { e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; u = u^v; v = u^v; u = u^v; e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; } void dfs(int u ,int dep) { vis[u] = true; first[u] = ++tot; ver[tot] = u; R[tot] = dep; for(int k=head[u]; k!=-1; k=e[k].next) if( !vis[e[k].v] ) { int v = e[k].v , w = e[k].w; dir[v] = dir[u] + w; dfs(v,dep+1); ver[++tot] = u; R[tot] = dep; } } void ST(int len) { int K = (int)(log((double)(len)) / log(2.0)); for(int i=1; i<=len; i++) dp[i][0] = i; for(int j=1; j<=K; j++) for(int i=1; i+__pow[j]-1 <= len; i++) { int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; if(R[a] < R[b]) dp[i][j] = a; else dp[i][j] = b; } } int RMQ(int x ,int y) { int K = (int)(log((double)(y-x+1)) / log(2.0)); int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; if(R[a] < R[b]) return a; else return b; } int LCA(int u ,int v) { int x = first[u] , y = first[v]; if(x > y) swap(x,y); int index = RMQ(x,y); return ver[index]; } int main() { for(int i=0; i<M; i++) __pow[i] = (1<<i); int n,m,k; scanf("%d",&n); k = 0; memset(head,-1,sizeof(head)); memset(vis,false,sizeof(vis)); for(int i=1;i<n;i++) { int u,v,w; scanf("%d%d%d",&u,&v,&w); add(u,v,w); } int q,kk; scanf("%d%d",&q,&kk); tot = dir[k] = 0; dfs(kk,1); ST(tot); while(q--) { int u,v,lca; scanf("%d%d",&u,&v); lca = LCA(u,v); if(lca==k) printf("%lld\n",dir[u] + dir[v] - 2*dir[lca]); else { printf("%lld\n",dir[u] + dir[v]); } } return 0; }
a.cc:10:1: error: 'll' does not name a type 10 | ll __pow[M]; | ^~ a.cc: In function 'void ST(int)': a.cc:45:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ^ a.cc:45:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~^~~~~~~~~ a.cc:45:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~^~ a.cc:45:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~~~~^~~~~~ a.cc:47:52: warning: pointer to a function used in arithmetic [-Wpointer-arith] 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith] a.cc:47:42: warning: pointer to a function used in arithmetic [-Wpointer-arith] 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ~^~~~~~~~~~~ a.cc:47:40: error: invalid types 'int [200020][30][double (*)(double, double) noexcept]' for array subscript 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ a.cc: In function 'int RMQ(int, int)': a.cc:56:40: warning: pointer to a function used in arithmetic [-Wpointer-arith] 56 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ^ a.cc:56:32: error: invalid operands of types 'int' and 'double(double, double) noexcept' to binary 'operator-' 56 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ~^~~~~~~~~ | | | | int double(double, double) noexcept a.cc: In function 'int main()': a.cc:71:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 71 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ^ a.cc:71:37: error: assignment of read-only location '*(__pow + ((sizetype)i))' 71 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ~~~~~~~~~^~~~~~~~ a.cc:81:16: error: too few arguments to function 'void add(int, int, int, int&)' 81 | add(u,v,w); | ~~~^~~~~~~ a.cc:19:13: note: declared here 19 | inline void add(int u , int v ,int w ,int &k) | ^~~
s772978313
p03634
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; #define N 200010 #define M 25 int tot; int __pow[M]; int head[N]; struct edge{ int u,v,w,next; }e[2*N]; int ver[2*N],R[2*N],first[N];long long dir[N]; int dp[2*N][30]; bool vis[N]; inline void add(int u , int v ,int w ,int &k) { e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; u = u^v; v = u^v; u = u^v; e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; } void dfs(int u ,int dep) { vis[u] = true; first[u] = ++tot; ver[tot] = u; R[tot] = dep; for(int k=head[u]; k!=-1; k=e[k].next) if( !vis[e[k].v] ) { int v = e[k].v , w = e[k].w; dir[v] = dir[u] + w; dfs(v,dep+1); ver[++tot] = u; R[tot] = dep; } } void ST(int len) { int K = (int)(log((double)(len)) / log(2.0)); for(int i=1; i<=len; i++) dp[i][0] = i; for(int j=1; j<=K; j++) for(int i=1; i+__pow[j]-1 <= len; i++) { int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; if(R[a] < R[b]) dp[i][j] = a; else dp[i][j] = b; } } int RMQ(int x ,int y) { int K = (int)(log((double)(y-x+1)) / log(2.0)); int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; if(R[a] < R[b]) return a; else return b; } int LCA(int u ,int v) { int x = first[u] , y = first[v]; if(x > y) swap(x,y); int index = RMQ(x,y); return ver[index]; } int main() { for(int i=0; i<M; i++) __pow[i] = (1<<i); int n,m,k; scanf("%d",&n); k = 0; memset(head,-1,sizeof(head)); memset(vis,false,sizeof(vis)); for(int i=1;i<n;i++) { int u,v,w; scanf("%d%d%d",&u,&v,&w); add(u,v,w); } int q,kk; scanf("%d%d",&q,&kk); tot = dir[k] = 0; dfs(kk,1); ST(tot); while(q--) { int u,v,lca; scanf("%d%d",&u,&v); lca = LCA(u,v); if(lca==k) printf("%lld\n",dir[u] + dir[v] - 2*dir[lca]); else { printf("%lld\n",dir[u] + dir[v]); } } return 0; }
a.cc:10:12: error: 'int __pow [25]' redeclared as different kind of entity 10 | int __pow[M]; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: previous declaration 'double __pow(double, double)' 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ a.cc: In function 'void ST(int)': a.cc:45:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ^ a.cc:45:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~^~~~~~~~~ a.cc:45:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~^~ a.cc:45:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~~~~^~~~~~ a.cc:47:52: warning: pointer to a function used in arithmetic [-Wpointer-arith] 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith] a.cc:47:42: warning: pointer to a function used in arithmetic [-Wpointer-arith] 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ~^~~~~~~~~~~ a.cc:47:40: error: invalid types 'int [400020][30][double (*)(double, double) noexcept]' for array subscript 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ a.cc: In function 'int RMQ(int, int)': a.cc:56:40: warning: pointer to a function used in arithmetic [-Wpointer-arith] 56 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ^ a.cc:56:32: error: invalid operands of types 'int' and 'double(double, double) noexcept' to binary 'operator-' 56 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ~^~~~~~~~~ | | | | int double(double, double) noexcept a.cc: In function 'int main()': a.cc:71:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 71 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ^ a.cc:71:37: error: assignment of read-only location '*(__pow + ((sizetype)i))' 71 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ~~~~~~~~~^~~~~~~~ a.cc:81:16: error: too few arguments to function 'void add(int, int, int, int&)' 81 | add(u,v,w); | ~~~^~~~~~~ a.cc:19:13: note: declared here 19 | inline void add(int u , int v ,int w ,int &k) | ^~~
s592719860
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long struct edge { signed to; signed cost; }; // <最短距離, 頂点の番号> using P = pair<signed, signed>; signed V; vector<edge> G[100000]; int d[100000][100000]; int memo[100000]; void dijkstra(int s) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); signed v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { cin >> V; for(int i=0; i<V-1; ++i) { signed a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/ccM7oae7.o: in function `dijkstra(long)': a.cc:(.text+0x1c): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccM7oae7.o a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccM7oae7.o a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccM7oae7.o collect2: error: ld returned 1 exit status
s982219286
p03634
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; #define N 100010 #define M 25 int tot; int __pow[M]; int head[N]; struct edge{ int u,v,w,next; }e[2*N]; int ver[2*N],R[2*N],first[N];long long dir[N]; int dp[2*N][30]; bool vis[N]; inline void add(int u , int v ,int w ,int &k) { e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; u = u^v; v = u^v; u = u^v; e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; } void dfs(int u ,int dep) { vis[u] = true; first[u] = ++tot; ver[tot] = u; R[tot] = dep; for(int k=head[u]; k!=-1; k=e[k].next) if( !vis[e[k].v] ) { int v = e[k].v , w = e[k].w; dir[v] = dir[u] + w; dfs(v,dep+1); ver[++tot] = u; R[tot] = dep; } } void ST(int len) { int K = (int)(log((double)(len)) / log(2.0)); for(int i=1; i<=len; i++) dp[i][0] = i; for(int j=1; j<=K; j++) for(int i=1; i+__pow[j]-1 <= len; i++) { int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; if(R[a] < R[b]) dp[i][j] = a; else dp[i][j] = b; } } int RMQ(int x ,int y) { int K = (int)(log((double)(y-x+1)) / log(2.0)); int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; if(R[a] < R[b]) return a; else return b; } int LCA(int u ,int v) { int x = first[u] , y = first[v]; if(x > y) swap(x,y); int index = RMQ(x,y); return ver[index]; } int main() { for(int i=0; i<M; i++) __pow[i] = (1<<i); int n,m,k; scanf("%d",&n); k = 0; memset(head,-1,sizeof(head)); memset(vis,false,sizeof(vis)); for(int i=1;i<n;i++) { int u,v,w; scanf("%d%d%d",&u,&v,&w); add(u,v,w); } int q,kk; scanf("%d%d",&q,&kk); tot = dir[1] = 0; dfs(kk,1); ST(tot); while(q--) { int u,v,lca; scanf("%d%d",&u,&v); lca = LCA(u,v); if(lca==k) printf("%lld\n",dir[u] + dir[v] - 2*dir[lca]); else { printf("%lld\n",dir[u] + dir[v]); } } return 0; }
a.cc:10:12: error: 'int __pow [25]' redeclared as different kind of entity 10 | int __pow[M]; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: previous declaration 'double __pow(double, double)' 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ a.cc: In function 'void ST(int)': a.cc:45:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ^ a.cc:45:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~^~~~~~~~~ a.cc:45:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~^~ a.cc:45:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 45 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~~~~^~~~~~ a.cc:47:52: warning: pointer to a function used in arithmetic [-Wpointer-arith] 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith] a.cc:47:42: warning: pointer to a function used in arithmetic [-Wpointer-arith] 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ~^~~~~~~~~~~ a.cc:47:40: error: invalid types 'int [200020][30][double (*)(double, double) noexcept]' for array subscript 47 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ a.cc: In function 'int RMQ(int, int)': a.cc:56:40: warning: pointer to a function used in arithmetic [-Wpointer-arith] 56 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ^ a.cc:56:32: error: invalid operands of types 'int' and 'double(double, double) noexcept' to binary 'operator-' 56 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ~^~~~~~~~~ | | | | int double(double, double) noexcept a.cc: In function 'int main()': a.cc:71:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 71 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ^ a.cc:71:37: error: assignment of read-only location '*(__pow + ((sizetype)i))' 71 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ~~~~~~~~~^~~~~~~~ a.cc:81:16: error: too few arguments to function 'void add(int, int, int, int&)' 81 | add(u,v,w); | ~~~^~~~~~~ a.cc:19:13: note: declared here 19 | inline void add(int u , int v ,int w ,int &k) | ^~~
s208387795
p03634
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; #define N 100010 #define M 25 int tot; int __pow[M]; int head[N]; struct edge{ int u,v,w,next; }e[2*N]; int ver[2*N],R[2*N],first[N];long long dir[N]; int dp[2*N][25]; bool vis[N]; inline void add(int u , int v ,int w ,int &k) { e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; u = u^v; v = u^v; u = u^v; e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; } void dfs(int u ,int dep) { vis[u] = true; first[u] = ++tot; ver[tot] = u; R[tot] = dep; for(int k=head[u]; k!=-1; k=e[k].next) if( !vis[e[k].v] ) { int v = e[k].v , w = e[k].w; dir[v] = dir[u] + w; dfs(v,dep+1); ver[++tot] = u; R[tot] = dep; } } void ST(int len) { int K = (int)(log((double)(len)) / log(2.0)); for(int i=1; i<=len; i++) dp[i][0] = i; for(int j=1; j<=K; j++) for(int i=1; i+__pow[j]-1 <= len; i++) { int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; if(R[a] < R[b]) dp[i][j] = a; else dp[i][j] = b; } } int RMQ(int x ,int y) { int K = (int)(log((double)(y-x+1)) / log(2.0)); int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; if(R[a] < R[b]) return a; else return b; } int LCA(int u ,int v) { int x = first[u] , y = first[v]; if(x > y) swap(x,y); int index = RMQ(x,y); return ver[index]; } int main() { for(int i=0; i<M; i++) __pow[i] = (1<<i); int n,m,k; scanf("%d",&n); k = 0; memset(head,-1,sizeof(head)); memset(vis,false,sizeof(vis)); for(int i=1;i<n;i++) { int u,v,w; scanf("%d%d%d",&u,&v,&w); add(u,v,w,k); } int q,kk; scanf("%d%d",&q,&kk); tot = dir[1] = 0; dfs(kk,1); ST(tot); while(q--) { int u,v,lca; scanf("%d%d",&u,&v); lca = LCA(u,v); if(lca==k) printf("%lld\n",dir[u] + dir[v] - 2*dir[lca]); else { printf("%lld\n",dir[u] + dir[v]); } } return 0; }
a.cc:10:12: error: 'int __pow [25]' redeclared as different kind of entity 10 | int __pow[M]; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: previous declaration 'double __pow(double, double)' 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ a.cc: In function 'void ST(int)': a.cc:46:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ^ a.cc:46:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~^~~~~~~~~ a.cc:46:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~^~ a.cc:46:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~~~~^~~~~~ a.cc:48:52: warning: pointer to a function used in arithmetic [-Wpointer-arith] 48 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith] a.cc:48:42: warning: pointer to a function used in arithmetic [-Wpointer-arith] 48 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ~^~~~~~~~~~~ a.cc:48:40: error: invalid types 'int [200020][25][double (*)(double, double) noexcept]' for array subscript 48 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ a.cc: In function 'int RMQ(int, int)': a.cc:57:40: warning: pointer to a function used in arithmetic [-Wpointer-arith] 57 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ^ a.cc:57:32: error: invalid operands of types 'int' and 'double(double, double) noexcept' to binary 'operator-' 57 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ~^~~~~~~~~ | | | | int double(double, double) noexcept a.cc: In function 'int main()': a.cc:72:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 72 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ^ a.cc:72:37: error: assignment of read-only location '*(__pow + ((sizetype)i))' 72 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ~~~~~~~~~^~~~~~~~
s142547164
p03634
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> using namespace std; #define N 40010 #define M 25 int tot; int __pow[M]; int head[N]; struct edge{ int u,v,w,next; }e[2*N]; int ver[2*N],R[2*N],first[N];long long dir[N]; int dp[2*N][25]; bool vis[N]; inline void add(int u , int v ,int w ,int &k) { e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; u = u^v; v = u^v; u = u^v; e[k].u = u; e[k].v = v; e[k].w = w; e[k].next = head[u]; head[u] = k++; } void dfs(int u ,int dep) { vis[u] = true; first[u] = ++tot; ver[tot] = u; R[tot] = dep; for(int k=head[u]; k!=-1; k=e[k].next) if( !vis[e[k].v] ) { int v = e[k].v , w = e[k].w; dir[v] = dir[u] + w; dfs(v,dep+1); ver[++tot] = u; R[tot] = dep; } } void ST(int len) { int K = (int)(log((double)(len)) / log(2.0)); for(int i=1; i<=len; i++) dp[i][0] = i; for(int j=1; j<=K; j++) for(int i=1; i+__pow[j]-1 <= len; i++) { int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; if(R[a] < R[b]) dp[i][j] = a; else dp[i][j] = b; } } int RMQ(int x ,int y) { int K = (int)(log((double)(y-x+1)) / log(2.0)); int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; if(R[a] < R[b]) return a; else return b; } int LCA(int u ,int v) { int x = first[u] , y = first[v]; if(x > y) swap(x,y); int index = RMQ(x,y); return ver[index]; } int main() { for(int i=0; i<M; i++) __pow[i] = (1<<i); int n,m,k; scanf("%d",&n); k = 0; memset(head,-1,sizeof(head)); memset(vis,false,sizeof(vis)); for(int i=1;i<n;i++) { int u,v,w; scanf("%d%d%d",&u,&v,&w); add(u,v,w,k); } int q,kk; scanf("%d%d",&q,&kk); tot = dir[1] = 0; dfs(kk,1); ST(tot); while(q--) { int u,v,lca; scanf("%d%d",&u,&v); lca = LCA(u,v); if(lca==k) printf("%lld\n",dir[u] + dir[v] - 2*dir[lca]); else { printf("%lld\n",dir[u] + dir[v]); } } return 0; }
a.cc:10:12: error: 'int __pow [25]' redeclared as different kind of entity 10 | int __pow[M]; | ^ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/requires_hosted.h:31, from /usr/include/c++/14/iostream:38, from a.cc:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: previous declaration 'double __pow(double, double)' 173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y)); | ^~~~~~~~~~~~~~ a.cc: In function 'void ST(int)': a.cc:46:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ^ a.cc:46:23: warning: pointer to a function used in arithmetic [-Wpointer-arith] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~^~~~~~~~~ a.cc:46:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~^~ a.cc:46:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 46 | for(int i=1; i+__pow[j]-1 <= len; i++) | ~~~~~~~~~~~~~^~~~~~ a.cc:48:52: warning: pointer to a function used in arithmetic [-Wpointer-arith] 48 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith] a.cc:48:42: warning: pointer to a function used in arithmetic [-Wpointer-arith] 48 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ~^~~~~~~~~~~ a.cc:48:40: error: invalid types 'int [80020][25][double (*)(double, double) noexcept]' for array subscript 48 | int a = dp[i][j-1] , b = dp[i+__pow[j-1]][j-1]; | ^ a.cc: In function 'int RMQ(int, int)': a.cc:57:40: warning: pointer to a function used in arithmetic [-Wpointer-arith] 57 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ^ a.cc:57:32: error: invalid operands of types 'int' and 'double(double, double) noexcept' to binary 'operator-' 57 | int a = dp[x][K] , b = dp[y-__pow[K]+1][K]; | ~^~~~~~~~~ | | | | int double(double, double) noexcept a.cc: In function 'int main()': a.cc:72:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 72 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ^ a.cc:72:37: error: assignment of read-only location '*(__pow + ((sizetype)i))' 72 | for(int i=0; i<M; i++) __pow[i] = (1<<i); | ~~~~~~~~~^~~~~~~~
s414096986
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long struct edge { int to; int cost; }; // <最短距離, 頂点の番号> using P = pair<int, int>; int V; vector<edge> G[100000]; int d[100000][100000]; int memo[100000]; void dijkstra(int s) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); int v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { cin >> V; for(int i=0; i<V-1; ++i) { int a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/ccJlpAcx.o: in function `dijkstra(long)': a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccJlpAcx.o a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccJlpAcx.o a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccJlpAcx.o collect2: error: ld returned 1 exit status
s393937439
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long struct edge { int to; int cost; }; // <最短距離, 頂点の番号> using P = pair<int, int>; int V; vector<edge> G[100000]; int d[100000][100000]; int memo[100000]; void dijkstra(int s) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); int v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { cin >> V; for(int i=0; i<V-1; ++i) { int a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/ccTn9dFa.o: in function `dijkstra(long long)': a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccTn9dFa.o a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccTn9dFa.o a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccTn9dFa.o collect2: error: ld returned 1 exit status
s241234178
p03634
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 4e5+9; ll n,k,q,tdfn,tot; ll dp[50][N],vis[N]; ll B[N],LOG[N],used[N],F[N],pos[N]; vector<pair<ll,ll> > edge[N]; void rmq_init(ll n,ll num[]) { ll i,j; for(j=1;j<=n;j++) dp[0][j]=num[j]; for(j=1;j<=LOG[n];j++) { ll limit=n+1-(1<<j); for(i=1;i<=limit;i++) { ll x=i+(1<<j>>1); dp[j][i]=min(dp[j-1][x],dp[j-1][i]); } } } ll rmq(ll l,ll r,ll num[]) { ll m=LOG[r-l+1]; return min(dp[m][l],dp[m][r-(1<<m)+1]); } ll sum[M]; void dfs(ll s) { ll i,t; used[s]=1; ll tmp=++tdfn; B[++tot]=tmp;F[tmp]=s; pos[s]=tot; for(i=0;i<edge[s].size();i++) { t=edge[s][i].first; if(used[t]) continue; sum[t]=sum[s]+edge[s][i].second; dfs(t); B[++tot]=tmp; } } ll lca(ll a,ll b) { if(pos[a]>pos[b]) swap(a,b); ll ans=rmq(pos[a],pos[b],B); return F[ans]; } int main() { ll i,a,b,w; LOG[0]=-1; for(i=1;i<N;i++) LOG[i]=LOG[i>>1]+1; cin >> n; for(i=0;i<=n;i++) edge[i].clear(); for(i=1;i<n;i++) { cin >> a >> b >> w; edge[a].push_back(make_pair(b,w)); edge[b].push_back(make_pair(a,w)); } sum[1]=0; tdfn=0; tot=0; memset(used,0,sizeof(used)); dfs(1); rmq_init(tot,B); cin >> q >> k; while(q--) { cin >> a >> b; cout << sum[a]+sum[k]-2*sum[lca(a,k)] + sum[b]+sum[k]-2*sum[lca(b,k)] << endl; } return 0; }
a.cc:29:8: error: 'M' was not declared in this scope 29 | ll sum[M]; | ^ a.cc: In function 'void dfs(ll)': a.cc:41:9: error: 'sum' was not declared in this scope 41 | sum[t]=sum[s]+edge[s][i].second; | ^~~ a.cc: In function 'int main()': a.cc:65:5: error: 'sum' was not declared in this scope 65 | sum[1]=0; | ^~~
s817154584
p03634
C++
//#define _GRIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define int long long struct edge { int to; int cost; }; // <最短距離, 頂点の番号> using P = pair<int, int>; int V; vector<edge> G[100000]; int d[100000][100000]; int memo[100000]; void dijkstra(int s) { if(memo[s]!=0) return; memo[s]++; priority_queue<P, vector<P>, greater<P> > que; fill(d[s], d[s]+V, LONG_MAX); d[s][s] = 0; que.push(P(0, s)); while (!que.empty()) { P p = que.top(); que.pop(); int v = p.second; if (d[s][v] < p.first) continue; for (int i=0; i<G[v].size(); ++i) { edge e = G[v][i]; if (d[s][e.to] > d[s][v] + e.cost) { d[s][e.to] = d[s][v] + e.cost; que.push(P(d[s][e.to], e.to)); } } } } signed main() { cin >> V; for(int i=0; i<V-1; ++i) { int a, b, c; cin >> a >> b >> c; a--; b--; edge e = {b, c}; G[a].push_back(e); e = {a, c}; G[b].push_back(e); } int q, k; cin >> q >> k; k--; dijkstra(k); int x, y; for(int j=0; j<q; ++j) { cin >> x >> y; x--; y--; dijkstra(x); cout << d[x][k] + d[k][y] << endl; } return 0; }
/tmp/ccUDmGMT.o: in function `dijkstra(long long)': a.cc:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccUDmGMT.o a.cc:(.text+0x48): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccUDmGMT.o a.cc:(.text+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccUDmGMT.o collect2: error: ld returned 1 exit status
s455489319
p03634
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define MAXN 100000 struct edge { int v,n; ll w; edge():v(0),w(0),n(0){} edge(int vv, ll ww, int nn):v(vv),w(ww),n(nn){} }; edge E[MAXN<<1]; int nE; int front[MAXN+1]; void add_edge(int u, int v, ll w) { int ne = ++nE; E[ne] = edge(v,w,u[front]); u[front] = ne; } int solid[MAXN+1]; ll d[MAXN+1]; void dijstra(int s) { set< pair<ll,int> > q; memset(d, -1, sizeof(d)); d[s] = 0; solid[s] = 1; q.insert(make_pair(0,s)); while(!q.empty()) { auto p = q.begin(); int u = p.second; solid[u] = 1; q.erase(q.begin()); for(int e=u[front];e;e = E[e].n) { int v = E[e].v; ll w = E[e].w; if((!solid[v]) && ((-1 == d[v]) || (d[u]+w < d[v]))) { q.erase(make_pair(d[v],v)); d[v] = d[u]+w; q.insert(make_pair(d[v],v)); } } } } int main(void) { int N = 0; int a = 0, b = 0; ll c = 0; scanf("%d", &N); while(N--) { scanf("%d %d %lld", &a, &b, &c); add_edge(a,b,c); add_edge(b,a,c); } int Q = 0, K = 0; int x = 0, y = 0; scanf("%d %d", &Q, &K); dijstra(K); while(Q--) { scanf("%d %d", &x, &y); printf("%lld\n", d[x]+d[y]); } return 0; }
a.cc: In function 'void dijstra(int)': a.cc:32:15: error: 'struct std::_Rb_tree_const_iterator<std::pair<long long int, int> >' has no member named 'second' 32 | int u = p.second; | ^~~~~~
s116250712
p03634
C++
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <queue> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> using namespace std; typedef long long ll; typedef unsigned long long ull; static const double EPS = 1e-8; static const double PI = 4.0 * atan(1.0); static const double PI2 = 8.0 * atan(1.0); #define REP(i,n) for(int i=0;i<(int)n;++i) #define ALL(c) (c).begin(),(c).end() #define CLEAR(v) memset(v,0,sizeof(v)) #define MP(a,b) make_pair((a),(b)) #define ABS(a) ((a)>0?(a):-(a)) #define FOR(i,s,n) for(int i=s;i<(int)n;++i) typedef pair<ll, ll> P; ll n, q, k, a, b, c, x, y; vector<P> es[100000]; ll d[100000]; void dfs(int v, int pa, ll x) { d[i] = x; REP(i, es[v].size()) if (es[v][i].second != pa) dfs(es[v][i].second, v, x + es[v][i].first); } int main(int argc, char **argv) { cin >> n; REP(i, n - 1) { cin >> a >> b >> c; --a; --b; es[a].push_back(MP(c, b)); es[b].push_back(MP(c, a)); } cin >> q >> k; dfs(0, -1, 0); REP(i, q) { cin >> x >> y; --x; --y; cout << (d[x] + d[y]) << endl; } return 0; }
a.cc: In function 'void dfs(int, int, ll)': a.cc:47:11: error: 'i' was not declared in this scope 47 | d[i] = x; | ^
s198849676
p03634
C++
#include <iostream> #include <cstdio> #define MAX_N 100000 using namespace std; typedef long long ll; struct Edge { int next, to; ll c; } edge[(MAX_N<<1)+5]; int n, m, k, cnt; int d[MAX_N+5], p[MAX_N+5][25], first[MAX_N+5],; ll tofa[MAX_N+5][25]; bool vis[MAX_N+5]; void INSERT(int a, int b, ll c) { edge[++cnt].next = first[a], edge[cnt].c = c; edge[cnt].to = b, first[a] = cnt; } void DFS(int u) { vis[u] = true; for (int i = 1; (1<<i) <= n; i++) { if ((1<<i) <= d[u]) { p[u][i] = p[p[u][i-1]][i-1]; tofa[u][i] = tofa[u][i-1]+tofa[p[u][i-1]][i-1]; } } for (int i = first[u]; i; i = edge[i].next) { int v = edge[i].to; if (!vis[v]) { d[v] = d[u]+1; p[v][0] = u; tofa[v][0] = edge[i].c; DFS(v); } } } ll LCA(int a, int b) { int i, j; ll ret = 0; if (d[a] < d[b]) swap(a, b); for (i = 0; (1<<i) <= d[a]; i++) {} i--; for (j = i; j >= 0; j--) { if (d[a]-(1<<j) >= d[b]) { ret += tofa[a][j]; a = p[a][j]; } } if (a == b) { return ret; } for (j = i; j >= 0; j--) { if (p[a][j] != p[b][j]) { ret += (tofa[a][j]+tofa[b][j]); a = p[a][j]; b = p[b][j]; } } return ret+tofa[a][0]+tofa[b][0]; } int main() { scanf("%d", &n); for (int i = 1; i < n; i++) { int u, v, c; cin >> u >> v >> c; INSERT(u, v, c), INSERT(v, u, c); } DFS(1); scanf("%d%d", &m, &k); for (int i = 0; i < m; i++) { int x, y; scanf("%d%d", &x, &y); printf("%lld\n", LCA(x, k)+LCA(k, y)); } return 0; }
a.cc:10:48: error: expected unqualified-id before ';' token 10 | int d[MAX_N+5], p[MAX_N+5][25], first[MAX_N+5],; | ^
s423741222
p03635
C
n, m = map(int, input().split()) print(~-n * ~-m)
main.c:1:1: warning: data definition has no type or storage class 1 | n, m = map(int, input().split()) | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] main.c:1:4: error: type defaults to 'int' in declaration of 'm' [-Wimplicit-int] 1 | n, m = map(int, input().split()) | ^ main.c:1:8: error: implicit declaration of function 'map' [-Wimplicit-function-declaration] 1 | n, m = map(int, input().split()) | ^~~ main.c:1:12: error: expected expression before 'int' 1 | n, m = map(int, input().split()) | ^~~ main.c:2:1: error: expected ',' or ';' before 'print' 2 | print(~-n * ~-m) | ^~~~~
s380644344
p03635
C++
#include <iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> #include<set> using namespace std; int main() { int n, m; cin >> n >> m; cout >> (n - 1)* (m - 1) << endl; }
a.cc: In function 'int main()': a.cc:15:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 15 | cout >> (n - 1)* (m - 1) << endl; | ~~~~ ^~ ~~~~~~~~~~~~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:15:14: note: candidate: 'operator>>(int, int)' (built-in) 15 | cout >> (n - 1)* (m - 1) << endl; | ~~~~~^~~~~~~~~~~~~~~~~~~ a.cc:15:14: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:15:32: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> (n - 1)* (m - 1) << endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:15:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 15 | cout >> (n - 1)* (m - 1) << endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:15:32: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> (n - 1)* (m - 1) << endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:15:32: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> (n - 1)* (m - 1) << endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:15:32: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> (n - 1)* (m - 1) << endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:15:32: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 15 | cout >> (n - 1)* (m - 1) << endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:15:32: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> (n - 1)* (m - 1) << endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:15:32: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 15 | cout >> (n - 1)* (m - 1) << endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]': a.cc:15:25: required from here 15 | cout >> (n - 1)* (m - 1) << endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s996084395
p03635
C++
#include<bits/stdc++.h> using namespace std; #define ll long long signed main() { int n,m; cin >> n >> m; int ans = 0; //ans = (n+1)*(m+1) -(n+m)*2; ans = nm-n-m+1; cout << ans << "\n"; }
a.cc: In function 'int main()': a.cc:11:9: error: 'nm' was not declared in this scope; did you mean 'm'? 11 | ans = nm-n-m+1; | ^~ | m
s061055172
p03635
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m ; cout << (n-1)(m-1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:16: error: expression cannot be used as a function 9 | cout << (n-1)(m-1) << endl; | ~~~~~^~~~~
s930353658
p03635
C++
#include<iostream> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<(a-1)*(b-1) }
a.cc: In function 'int main()': a.cc:6:20: error: expected ';' before '}' token 6 | cout<<(a-1)*(b-1) | ^ | ; 7 | } | ~
s264030641
p03635
C++
#include <bits/stdc++.h> using namespace std; if main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a, b; string x; cin >> a >> b >> x; //scanf(“%d %d”, &a, &b) cout << a << “ “ << b << “ “ << x << “\n” //printf(“%d”, (a-1)*(b-1)) }
a.cc:9:14: error: extended character “ is not valid in an identifier 9 | cout << a << “ “ << b << “ “ << x << “\n” | ^ a.cc:9:16: error: extended character “ is not valid in an identifier 9 | cout << a << “ “ << b << “ “ << x << “\n” | ^ a.cc:9:26: error: extended character “ is not valid in an identifier 9 | cout << a << “ “ << b << “ “ << x << “\n” | ^ a.cc:9:28: error: extended character “ is not valid in an identifier 9 | cout << a << “ “ << b << “ “ << x << “\n” | ^ a.cc:9:38: error: extended character “ is not valid in an identifier 9 | cout << a << “ “ << b << “ “ << x << “\n” | ^ a.cc:9:39: error: stray '\' in program 9 | cout << a << “ “ << b << “ “ << x << “\n” | ^ a.cc:9:40: error: extended character ” is not valid in an identifier 9 | cout << a << “ “ << b << “ “ << x << “\n” | ^ a.cc:3:1: error: expected unqualified-id before 'if' 3 | if main() { | ^~
s472875826
p03635
C
#include<stdio.h> main() { int a, b, c; scanf(&d, a); scanf(&d, b); c = a - 1 * b - 1; printf(&d, c); }
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int] 2 | main() { | ^~~~ main.c: In function 'main': main.c:4:10: error: 'd' undeclared (first use in this function) 4 | scanf(&d, a); | ^ main.c:4:10: note: each undeclared identifier is reported only once for each function it appears in
s922096656
p03635
C
include<stdio.h> int main() { int a, b, c; scanf(&d, a); scanf(&d, b); c = a - 1 * b - 1; printf(&d, c); }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^
s277799369
p03635
C++
#include<iostream> using namespace std; int main() { int a,b; cin >> a >> b; int ans = (a-1) * (b-1); cout >> ans >> endl; }
a.cc: In function 'int main()': a.cc:8:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 8 | cout >> ans >> endl; | ~~~~ ^~ ~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:8:14: note: candidate: 'operator>>(int, int)' (built-in) 8 | cout >> ans >> endl; | ~~~~~^~~~~~ a.cc:8:14: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:8:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> ans >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:8:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 8 | cout >> ans >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:8:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:8:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:8:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:8:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:8:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:8:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:8:12: required from here 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s043133518
p03635
C++
#include<iostream> using namespace std; int main() { int a,b; cin >> a >> b; cout >> (a-1) * (b-1) >> endl; }
a.cc: In function 'int main()': a.cc:7:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 7 | cout >> (a-1) * (b-1) >> endl; | ~~~~ ^~ ~~~~~~~~~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:7:14: note: candidate: 'operator>>(int, int)' (built-in) 7 | cout >> (a-1) * (b-1) >> endl; | ~~~~~^~~~~~~~~~~~~~~~ a.cc:7:14: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:7:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 7 | cout >> (a-1) * (b-1) >> endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:7:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 7 | cout >> (a-1) * (b-1) >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:7:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 7 | cout >> (a-1) * (b-1) >> endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:7:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 7 | cout >> (a-1) * (b-1) >> endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:7:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 7 | cout >> (a-1) * (b-1) >> endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:7:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 7 | cout >> (a-1) * (b-1) >> endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:7:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 7 | cout >> (a-1) * (b-1) >> endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:7:29: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 7 | cout >> (a-1) * (b-1) >> endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int]': a.cc:7:24: required from here 7 | cout >> (a-1) * (b-1) >> endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s851854511
p03635
C++
#include <bits/stdc++.h> using namespace std; int main(){ int A,B; cin >> A >> B; cout << (A -1) * (B - 1) }
a.cc: In function 'int main()': a.cc:7:27: error: expected ';' before '}' token 7 | cout << (A -1) * (B - 1) | ^ | ; 8 | } | ~
s137152532
p03635
C
#include<stdio.h> int main(void){ int m,n,s; scanf("%d%d",&n,&m); s=(n-1)*(m-1); printf("%d\n"s); return 0; }
main.c: In function 'main': main.c:6:16: error: expected ')' before 's' 6 | printf("%d\n"s); | ~ ^ | )
s598465661
p03635
C
#include<stdio.h> int main(){ int m,n; scanf("%d%d",&m,&n); pritnf("%d",(m-1)*(n-1)); }
main.c: In function 'main': main.c:5:3: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration] 5 | pritnf("%d",(m-1)*(n-1)); | ^~~~~~ | printf
s335684554
p03635
C
/* ex6_1 kosaq */ #include <stdio.h> #include <string.h> #define SIZE 101//十分な要素数 int main(void){ char string_s[SIZE];//入力に使う文字列を定義 int number_total;//全文字数を定義 scanf("%s", string_s);//文字列を入力 number_total = strlen(string_s);//全文字数は入力された文字列の長さに等しい printf("%c %d %c\n", string_s[0], number_total - 2, string_s[i - 1]); //string_s[0]は先頭の文字を出力、number_total - 2は間の文字数を出力、string_s[i - 1]は最後の文字を出力 return 0; }
main.c: In function 'main': main.c:16:66: error: 'i' undeclared (first use in this function) 16 | printf("%c %d %c\n", string_s[0], number_total - 2, string_s[i - 1]); | ^ main.c:16:66: note: each undeclared identifier is reported only once for each function it appears in
s718823462
p03635
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; a-=; b-=; cout << a*b << endl; }
a.cc: In function 'int main()': a.cc:7:4: error: expected primary-expression before ';' token 7 | a-=; | ^ a.cc:8:4: error: expected primary-expression before ';' token 8 | b-=; | ^
s080445600
p03635
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main(){ int n,m; cin >> n >> m; cout < (n-1)*(m-1) << endl; }
a.cc: In function 'int main()': a.cc:8:22: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 8 | cout < (n-1)*(m-1) << endl; | ~~~~~~~~~~~~^~~~~~~
s211669485
p03635
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; cout<<(N-1)*(m-1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:10: error: 'N' was not declared in this scope 6 | cout<<(N-1)*(m-1)<<endl; | ^
s302922514
p03635
C++
#include <bits/std.c++.h> using namespace std; int main(void){ // Your code here! int a,b; cin>>a>>b; cout<<(a-1)*(b-1); }
a.cc:1:10: fatal error: bits/std.c++.h: No such file or directory 1 | #include <bits/std.c++.h> | ^~~~~~~~~~~~~~~~ compilation terminated.
s995686349
p03635
C++
#include<bit/stdc++.h> using namespace std; int main() { int N; cin>>N; cout<<"ABC"<<N; }
a.cc:1:13: fatal error: bit/stdc++.h: No such file or directory 1 | #include<bit/stdc++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s557385094
p03635
C++
#include<iostream> using namespace std; int main() { cin >> a >> b; --a; --b; cout << a * b << endl; }
a.cc: In function 'int main()': a.cc:5:10: error: 'a' was not declared in this scope 5 | cin >> a >> b; | ^ a.cc:5:15: error: 'b' was not declared in this scope 5 | cin >> a >> b; | ^
s797341231
p03635
C++
#include <iostream> #include <algorithm> #include <complex> #include <utility> #include <vector> #include <string> #include <queue> #include <tuple> #include <cmath> #include <bitset> #include <cctype> #include <set> #include <map> #include <numeric> #include <functional> #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() #define PRINT(V) cout << V << "\n" #define SORT(V) sort((V).begin(),(V).end()) #define RSORT(V) sort((V).rbegin(), (V).rend()) using namespace std; using ll = long long; 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; } inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); } template<class itr> void cins(itr first,itr last){ for (auto i = first;i != last;i++){ cin >> (*i); } } template<class itr> void array_output(itr start,itr goal){ string ans = "",k = " "; for (auto i = start;i != goal;i++) ans += to_string(*i)+k; if (!ans.empty()) ans.pop_back(); PRINT(ans); } ll gcd(ll a, ll b) { return a ? gcd(b%a,a) : b; } const ll INF = 1e15; const ll MOD = 1000000007; typedef pair<ll,ll> P; const ll MAX = 400010; constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1}; constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1}; int main(){ cin.tie(0); ios::sync_with_stdio(false); ll n = 100000; int n,m; cin >> n >> m; PRINT((n-1)*(m-1)); }
a.cc: In function 'int main()': a.cc:53:9: error: conflicting declaration 'int n' 53 | int n,m; | ^ a.cc:52:8: note: previous declaration as 'll n' 52 | ll n = 100000; | ^
s858716285
p03635
C++
#include<bits/stdc++.h> int n,m; int main() { cin>>n>>m; if(m==1||n==1) cout<<0<<endl; cout<<(n-1)*(m-1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin>>n>>m; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, 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:8:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 8 | cout<<0<<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:8:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 8 | cout<<0<<endl; | ^~~~ | std::endl 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: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:9:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout<<(n-1)*(m-1)<<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:9:28: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout<<(n-1)*(m-1)<<endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s488411488
p03635
C++
#include<bits/stdc++.h> int n,m; int main() { cin>>n>>m; if(m==1||n==1) cout<<0<<endl; cout<<(n-1)*(m-1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin>>n>>m; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, 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:8:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 8 | cout<<0<<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:8:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 8 | cout<<0<<endl; | ^~~~ | std::endl 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: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:9:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout<<(n-1)*(m-1)<<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:9:28: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout<<(n-1)*(m-1)<<endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s322870617
p03635
C++
#include<bits/stdc++.h> int n,m; int main() { cin>>n>>m; if(m==1||n==1) cout<<0<<endl; cout<<(n-1)*(m-1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin>>n>>m; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, 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:8:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 8 | cout<<0<<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:8:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 8 | cout<<0<<endl; | ^~~~ | std::endl 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: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:9:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | cout<<(n-1)*(m-1)<<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:9:28: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | cout<<(n-1)*(m-1)<<endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s906054964
p03635
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n.m; cin>>n>>m; cout<<(n-1)*(m-1)<<endl; }
a.cc: In function 'int main()': a.cc:4:8: error: expected initializer before '.' token 4 | int n.m; | ^ a.cc:5:8: error: 'n' was not declared in this scope; did you mean 'yn'? 5 | cin>>n>>m; | ^ | yn a.cc:5:11: error: 'm' was not declared in this scope; did you mean 'tm'? 5 | cin>>n>>m; | ^ | tm
s158682049
p03635
C++
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; cout << (n-1)*(m-1) }
a.cc: In function 'int main()': a.cc:8:28: error: expected ';' before '}' token 8 | cout << (n-1)*(m-1) | ^ | ; 9 | } | ~
s882001250
p03635
Java
import java.util.*; public class Main{ public static void main(Stinrg[] args){ Scanner sc = new Scanner(System.in); String S = sc.next(); int len = S.lenght()-2; char s1 = S.charAt(0); char s2 = S.charAt(S.length()-1); System.out.println(s1+len+s2); } }
Main.java:4: error: cannot find symbol public static void main(Stinrg[] args){ ^ symbol: class Stinrg location: class Main Main.java:7: error: cannot find symbol int len = S.lenght()-2; ^ symbol: method lenght() location: variable S of type String 2 errors
s250430546
p03635
C++
n,m = map(int,input().split()) print((n-1)*(m-1))
a.cc:1:1: error: 'n' does not name a type 1 | n,m = map(int,input().split()) | ^
s338757934
p03635
C++
import sys import heapq, math from itertools import zip_longest, permutations, combinations, combinations_with_replacement from itertools import accumulate, dropwhile, takewhile, groupby from functools import lru_cache from copy import deepcopy N, M = map(int, input().split()) print((N - 1) * (M - 1))
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s692738303
p03635
C++
result = [int(i) for i in input().split()] print((result[0] - 1) * (result[1] - 1))
a.cc:1:1: error: 'result' does not name a type 1 | result = [int(i) for i in input().split()] | ^~~~~~
s053260483
p03635
C++
#include<bits/stdc++.h> using namespace std; int h,m,ans; int main(){ cin>>h>>m; ans=(a-1)*(b-1); cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:14: error: 'a' was not declared in this scope 6 | ans=(a-1)*(b-1); | ^ a.cc:6:20: error: 'b' was not declared in this scope 6 | ans=(a-1)*(b-1); | ^
s197693549
p03635
C++
#include<istream> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<(a-1)*(b-1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:3: error: 'cin' was not declared in this scope 5 | cin>>a>>b; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<istream> +++ |+#include <iostream> 2 | using namespace std; a.cc:6:3: error: 'cout' was not declared in this scope 6 | cout<<(a-1)*(b-1)<<endl; | ^~~~ a.cc:6:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s377115957
p03635
C++
#include <bits/stdc++.h> using namespace std; int main() { string S,s ; int C; cin>>S; C= S.size(); s=S[0]&c-2&S[C]; cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:12:10: error: 'c' was not declared in this scope 12 | s=S[0]&c-2&S[C]; | ^
s229630306
p03635
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int length = s.length; cout << s[0] + to_string(length - 2) + s[length-1] << endl; }
a.cc: In function 'int main()': a.cc:7:20: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int' 7 | int length = s.length; | ^~~~~~
s750730584
p03635
C++
#include<iostream> #include<string> using namespace std; int main(){ string S; cin>>S; cout<<S.front()<<S.length()-2<<S.end(); }
a.cc: In function 'int main()': a.cc:7:32: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'std::__cxx11::basic_string<char>::iterator') 7 | cout<<S.front()<<S.length()-2<<S.end(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ | | | | | std::__cxx11::basic_string<char>::iterator | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/iostream:41, 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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 'std::__cxx11::basic_string<char>::iterator' 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
s734122416
p03635
C++
#include bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; if (n==0&&m==0) cout<<0<<endl; else cout<<(n-1)*(m-1)<<endl; return 0; }
a.cc:1:10: error: #include expects "FILENAME" or <FILENAME> 1 | #include bits/stdc++.h> | ^~~~ a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin>>n>>m; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #include bits/stdc++.h> a.cc:7:21: error: 'cout' was not declared in this scope 7 | if (n==0&&m==0) cout<<0<<endl; | ^~~~ a.cc:7:21: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:7:30: error: 'endl' was not declared in this scope 7 | if (n==0&&m==0) cout<<0<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #include bits/stdc++.h> a.cc:8:10: error: 'cout' was not declared in this scope 8 | else cout<<(n-1)*(m-1)<<endl; | ^~~~ a.cc:8:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:8:29: error: 'endl' was not declared in this scope 8 | else cout<<(n-1)*(m-1)<<endl; | ^~~~ a.cc:8:29: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'