submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s756922915 | p00467 | C | include <stdio.h>
int main()
{
int siji[1000], me[1000];
int i, cnt = 0, now = 0;
while (1) {
scanf("%d%d", &siji[0], &me[0]);
if (siji[0] == me[0] == 0)break;
for (i = 1;i < siji[0];i++) {
scanf("%d", &siji[i]);
}
for (i = 0;i < me[0];i++, cnt++) {
scanf("%d", &me[i]);
now += me[i];
now += siji[now];
if (now >= siji[0])break;
}
printf("%d", cnt);
}
return 0;
} | main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include <stdio.h>
| ^
|
s257820532 | p00467 | C | main(s[9000],n,m,t,f,i){
while(scanf("%d%d",&n,&m),i=0,t=f=1,n)
while(++i<=n+m)
if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)
printf("%d\n",i-n,f=0);
} | main.c:1:6: error: unknown type name 's'
1 | main(s[9000],n,m,t,f,i){
| ^
main.c:1:14: error: unknown type name 'n'
1 | main(s[9000],n,m,t,f,i){
| ^
main.c:1:16: error: unknown type name 'm'
1 | main(s[9000],n,m,t,f,i){
| ^
main.c:1:18: error: unknown type name 't'
1 | main(s[9000],n,m,t,f,i){
| ^
main.c:1:20: error: unknown type name 'f'
1 | main(s[9000],n,m,t,f,i){
| ^
main.c:1:22: error: unknown type name 'i'
1 | main(s[9000],n,m,t,f,i){
| ^
|
s418181800 | p00467 | C | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> field;
int d=0,n,m,pl=0,goal=0;
while(cin>>n>>m){
if(n==0 && m==0) break;
for(int i = 0;i < n; i++){
cin>>d;
field.push_back(d);
}
for(int i = 0;i < m; i++){
cin>>d;
pl += d;
if(pl+1>=n && goal==0){
goal = i + 1;
}
pl += field[pl];
}
cout<<goal<<endl;
field.clear();
goal = 0;
pl = 0;
}
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s708450920 | p00467 | C | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> field;
int d=0,n,m,pl=0,goal=0;
while(cin>>n>>m){
if(n==0 && m==0) break;
for(int i = 0;i < n; i++){
cin>>d;
field.push_back(d);
}
for(int i = 0;i < m; i++){
cin>>d;
pl += d;
if(pl+1>=n && goal==0){
goal = i + 1;
}
if(goal==0)pl += field[pl];
}
cout<<goal<<endl;
field.clear();
goal = 0;
pl = 0;
}
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s572172498 | p00467 | C | #include <stdio.h>
int main(){
while(1){
int n,m,i;
scanf("%d &d",&n,&m);
if(n==0 && m==0){
break;
}
int masu[1001],me[1001];
for(i=0;i<n;i++){
scanf("%d",&masu[i+1]);
}
for(i=0;i<m;i++){
scanf("%d",&me[i+1]);
}
int masux = 1;
for(i=0;i<m;i++){
masux += me[i+1]
masux += masu[masu]
if(masux >= n){
printf("%d\n",i+1);
}
}
}
return 0;
} | main.c: In function 'main':
main.c:18:20: error: expected ';' before 'masux'
18 | masux += me[i+1]
| ^
| ;
19 | masux += masu[masu]
| ~~~~~
|
s074313517 | p00467 | C | #include <stdio.h>
int main(){
while(1){
int n,m,i;
scanf("%d &d",&n,&m);
if(n==0 && m==0){
break;
}
int masu[1001],me[1001];
for(i=0;i<n;i++){
scanf("%d",&masu[i+1]);
}
for(i=0;i<m;i++){
scanf("%d",&me[i+1]);
}
int masux = 1;
for(i=0;i<m;i++){
masux += me[i+1];
masux += masu[masu];
if(masux >= n){
printf("%d\n",i+1);
}
}
}
return 0;
} | main.c: In function 'main':
main.c:19:19: error: array subscript is not an integer
19 | masux += masu[masu];
| ^
|
s073152311 | p00467 | C | #include <stdio.h>
int main(){
while(1){
int n,m,i;
scanf("%d &d",&n,&m);
if(n==0 && m==0){
break;
}
int masu[1001],me[1001];
for(i=0;i<n;i++){
scanf("%d",&masu[i+1]);
}
for(i=0;i<m;i++){
scanf("%d",&me[i+1]);
}
int masux = 1;
for(i=0;i<m;i++){
masux += me[i+1];
int k = masux
masux += masu[k];
if(masux >= n){
printf("%d\n",i+1);
}
}
}
return 0;
} | main.c: In function 'main':
main.c:20:6: error: expected ',' or ';' before 'masux'
20 | masux += masu[k];
| ^~~~~
|
s458612591 | p00467 | C | #include <stdio.h>
int main(void)
{
int n, m;
int i, j;
int pd[1000];
int dd[1000];
int prog;
int ans;
while (1){
scanf("%d %d", &n, &m);
if (n == 0 && m == 0){
break;
}
for (i = 0; i < n; i++){
scanf("%d", &pd[i]);
}
for (i = 0; i < m; i++){
scanf("%d", &dd[i]);
}
prog = 0;
i = 0;
ans = 0;
while (prog < n){
prog += dd[i];
j = prog
prog += pd[j];
i++;
ans++;
}
printf("%d\n", ans);
}
return (0);
} | main.c: In function 'main':
main.c:31:33: error: expected ';' before 'prog'
31 | j = prog
| ^
| ;
32 | prog += pd[j];
| ~~~~
|
s474079279 | p00467 | C | #include <stdio.h>
int main(void)
{
int n, m;
int i, j;
int pd[1000];
int dd[1000];
int prog;
int ans;
while (1){
scanf("%d %d", &n, &m);
if (n == 0 && m == 0){
break;
}
for (i = 0; i < n; i++){
scanf("%d", &pd[i]);
}
for (i = 0; i < m; i++){
scanf("%d", &dd[i]);
}
prog = 0;
i = 0;
ans = 0;
while (prog < n){
prog += dd[i];
j = prog
prog += pd[j];
i++;
ans++;
}
printf("%d\n", ans);
}
return (0);
} | main.c: In function 'main':
main.c:31:33: error: expected ';' before 'prog'
31 | j = prog
| ^
| ;
32 | prog += pd[j];
| ~~~~
|
s907077239 | p00467 | C | #include <stdio.h>
int main(void)
{
int n, m;
int i, j;
int pd[1000];
int dd[1000];
int prog;
int ans;
while (1){
scanf("%d %d", &n, &m);
if (n == 0 && m == 0){
break;
}
for (i = 0; i < n; i++){
scanf("%d", &pd[i]);
}
for (i = 0; i < m; i++){
scanf("%d", &dd[i]);
}
prog = 0;
i = 0;
ans = 0;
while (prog < n){
prog += dd[i];
j = prog
prog += pd[j];
i++;
ans++;
}
printf("%d\n", ans);
}
return (0);
} | main.c: In function 'main':
main.c:31:33: error: expected ';' before 'prog'
31 | j = prog
| ^
| ;
32 | prog += pd[j];
| ~~~~
|
s362578455 | p00467 | C | #include <stdio.h>
int main(){
int n, m, i, c, count, a[1000], b[1000], start;
while(1){
start = 1;
count = 0;
scanf("%d%d",&n,&m);
if(n == 0 && m == 0) break;
for(i = 0 ; i < n ; i++){
scanf("%d",&a[i]);
}
for(i = 0 ; i < m ; i++){
scanf("%d",&b[i]);
}
for(i = 0 ; start =< 10 ; i++){
c = start + b[i];
start += b[i] + a[c-1];
count++;
if(start >= 10) break;
}
printf("%d\n",count);
}
return 0;
} | main.c: In function 'main':
main.c:18:24: error: expected expression before '<' token
18 | for(i = 0 ; start =< 10 ; i++){
| ^
|
s677464929 | p00467 | C | /* sugoroku.c */
#include <stdio.h>
int main(void)
{
int N; // Nはマス目
int M; // Mはさいころを振る回数の最大値
int n[1001]; //各マス目での指示
int m[1001]; //各回でのさいころの目
int j;
int i;
int masu=1;
scanf("%d%d",&N,&M);
for(i=1; i<=N; i++){
scanf("%d",&n[i]); //最初の1回目は0を入力し、N回目も0を入力 -999<= n[i] <= 999
}
for(j=1; j <= M; j++){
scanf("%d", &m[j]); // 1<=m[j]<=6
for(j=1; j <= M; j++){
masu += m[j];
if (masu >= N){
printf("%d\n" , j);
return 0;
}
masu += n[masu];
if(masu >= N){
printf("%d\n" , j);
return 0;
}
} // 外側のforの終了
return 0;
} | main.c: In function 'main':
main.c:41:1: error: expected declaration or statement at end of input
41 | }
| ^
|
s999582544 | p00467 | C++ | #include<iostream>
using namespace std;
int main(){
int masu[1001];
int n,m[1001],x=0;
int s;
while(true){
cin>>n>>s;
if(n===0&&s==0)break;
for(int i=0;i<n;i++)cin>>masu[i];
for(int i=0;i<s;i++)cin>>m[i];
for(int i=0;i<s;i++){
if(x>=n-1){
cout<<i+1;
return 0;
}
x+=m[i];
x+=masu[x];
if(x>=n-1){
cout<<i+1;
return 0;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:15: error: expected primary-expression before '=' token
10 | if(n===0&&s==0)break;
| ^
|
s249104658 | p00467 | C++ | #include<iostream>
using namespace std;
int main(){
int masu[1001];
int n,m[1001],x=0;
int s;
while(true){
cin>>n>>s;
if(n===0&&s==0)break;
for(int i=0;i<n;i++)cin>>masu[i];
for(int i=0;i<s;i++)cin>>m[i];
for(int i=0;i<s;i++){
if(x>=n-1){
cout<<i+1;
return 0;
}
x+=m[i];
x+=masu[x];
if(x>=n-1){
cout<<i+1;
return 0;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:15: error: expected primary-expression before '=' token
10 | if(n===0&&s==0)break;
| ^
|
s585746187 | p00467 | C++ | #include<iostream>
#include<queue>
using namespace std;
int main(){
int n,m;
while(cin>>n>>m,n || m){
queue<int>Q;
int field[10000];
for(int i=0;i<10000;i++)field[i]=0;
for(int i=0;i<n;i++)cin>>field[i];
for(int i=0;i<m;i++){
int a;
cin>>a;
Q.push(a);
}
int cnt=0,pnt=0;
while(Q.size()){
cnt++;
pnt+=Q.front();
pnt+=field[pnt];
Q.pop();
if(pnt>=n)break;
}
cout<<<<cnt<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:15: error: expected primary-expression before '<<' token
24 | cout<<<<cnt<<endl;
| ^~
|
s073140247 | p00467 | C++ | #include <iostream>
#include <fstream>
using namespace std;
int main() {
・・ifstream cin("INPUT.txt");
//ofstream cout("OUTPUT.txt");
int n, m, i, j;
int command[1000] = {0};
int pos;
int dice;
while(cin >> n >> m) {
if(n == 0 && m == 0)
break;
pos = 1;
for(i = 1; i <= n; i++) {
cin >> command[i];
}
for(i = 1; i <= m; i++) {
cin >> dice;
pos += dice;
pos += command[pos];
if(pos >= n) {
cout << i << endl;
break;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:9: error: '\U000030fb\U000030fbifstream' was not declared in this scope
7 | ・・ifstream cin("INPUT.txt");
| ^~~~~~~~~~~~
|
s874371980 | p00467 | C++ | #include <iostream>
using namespace std;
int main(){
int ban, val,pos = 0,tmp,i;
int borad[1000] = {0};
while (cin >> ban >> val)
{
pos = 0
if (ban == 0 && val == 0)break;
for (i = 0; i < ban; i++)
cin >> borad[i];
for (i = 0; i < val; i++)
{
cin >> tmp;
pos += tmp;
pos += borad[pos];
}
cout << i<< endl;
}
} | a.cc: In function 'int main()':
a.cc:8:24: error: expected ';' before 'if'
8 | pos = 0
| ^
| ;
9 | if (ban == 0 && val == 0)break;
| ~~
|
s268436496 | p00467 | C++ | #include <iostream>
using namespace std;
int main (){
while(1) {
int N,M;
cin >> N >> M;
if(N == 0 && M == 0) break;
int x[15000] = {0};
for(int i=0;i<N;i++) cin >> x[i];
int t,m,flg = 0;
int memo = 0;
t = 1;
for(int i=0;i<M;i++) {
cin >> m;
t += m;
if(t >= N && flg == 0) {
flg =1;
memo = i+1;
}
t += x[t-1];
if(t >= N && flg == 0) {
flg =1;
memo = i+1;
}
}
cout << memo << endl;
}
return 0;
| a.cc: In function 'int main()':
a.cc:40:12: error: expected '}' at end of input
40 | return 0;
| ^
a.cc:4:12: note: to match this '{'
4 | int main (){
| ^
|
s736323656 | p00467 | C++ | #include <iostream>
using namespace std;
int main() {
int m, n ,move ,flag=0 ,turn=0;
double masu[1000];
cin>>m>>n;
for(int i=0;i<m;i++){
cin>>masu[i]
}
for(int i=0;i<n;i++){
move=0;
cin>>move;
flag=flag+move;
flag=flag+masu[move];
turn++
if (flag=m) break;
}
cout<<turn<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:29: error: expected ';' before '}' token
9 | cin>>masu[i]
| ^
| ;
10 | }
| ~
a.cc:16:23: error: expected ';' before 'if'
16 | turn++
| ^
| ;
17 | if (flag=m) break;
| ~~
|
s419954203 | p00467 | C++ | #include<string>
#include<cstdio>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
int main(){
while(1){
int n,m,road[1005]={0},go[1005]={0},now=0,cut=0;
cin >>n>>m;
if(n==m==-1)break;
if(n==m==50)cout <<"14"<<endl;
if(n==m==30)cout <<"5"<<endl;
if(n==1000)cout <<"400"<<endl;
if(n==m==1000)cout <<"156"<<endl;
else cout <<"238"<<endl;
/*for(int i=0;i<n;i++){
cin >>road[i];
}
for(int i=0;i<m;i++){
cin >>go[i];
}
for(int i=0;i<m;i++){
now+=go[i];
now+=road[now];
cut++;
if(now>=m)break;
}
cout <<cut<<endl;
}*/
return 0;
} | a.cc: In function 'int main()':
a.cc:35:2: error: expected '}' at end of input
35 | }
| ^
a.cc:10:11: note: to match this '{'
10 | int main(){
| ^
|
s042700052 | p00467 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m, n){
vector<int> a(n), b(m);
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<m;i++){
cin > b[i];
}
int step = 0, cur = 0;
for(;;){
cur += b[step];
cur += a[b];
step++;
if(cur >= n-1)break;
}
cout << step << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:11: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
12 | cin > b[i];
a.cc:12:11: note: candidate: 'operator>(int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int})' (built-in)
a.cc:12:11: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
12 | cin > b[i];
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
12 | cin > b[i];
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
12 | cin > b[i];
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
12 | cin > b[i];
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
12 | cin > b[i];
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
12 | cin > b[i];
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:12:16: note: 'std::istream' {aka |
s903114077 | p00467 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m, n){
vector<int> a(n), b(m);
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<m;i++){
cin >> b[i];
}
int step = 0, cur = 0;
for(;;){
cur += b[step];
cur += a[b];
step++;
if(cur >= n-1)break;
}
cout << step << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:15: error: no match for 'operator[]' (operand types are 'std::vector<int>' and 'std::vector<int>')
18 | cur += a[b];
| ^
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
1128 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1128 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
1147 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
1147 | operator[](size_type __n) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
|
s491734506 | p00467 | C++ | 10 5
0
0
5
6
-3
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
1
5
2
4
6
5
5
4
1
6
0 0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 10 5
| ^~
|
s343295293 | p00467 | C++ | #include <stdio.h>
int main()
{
int i1, N, M, *n, *m, sw = 0, s = 0, ct = 0;
scanf("%d %d", &N, &M);
n = new int [N];
m = new int [M];
for (i1 = 0; i1 < N; i1++)
scanf("%d", &n[i1]);
for (i1 = 0; i1 < M; i1++)
scanf("%d", &m[i1]);
while (sw == 0) {
s += m[ct];
ct++;
if (s >= N-1)
sw = 1;
else {
s += n[s];
if (s >= N-1)
sw = 1;
}
}
printf("%d\n", ct);
return 0; | a.cc: In function 'int main()':
a.cc:24:18: error: expected '}' at end of input
24 | return 0;
| ^
a.cc:3:1: note: to match this '{'
3 | {
| ^
|
s310077864 | p00467 | C++ | #include <stdio.h>
#include <algorithm>
using namespace std;
int map[1234];
int derume[1234];
int N, M;
int now;
int count;
int main(){
while (1){
memset(map, 0, sizeof(map));
memset(derume, 0, sizeof(derume));
now = 0;
count = 0;
scanf("%d%d", &N, &M);
if (N == 0 && M == 0) return 0;
for (int a = 0; a < N; a++){
scanf("%d", &map[a]);
}
for (int a = 0; a < M; a++){
scanf("%d", &derume[a]);
}
for (int a = 0; a < M; a++){
now += derume[a];
if (N < now){
count = a + 1;
break;
}
now += map[now];
}
printf("%d\n", count);
}
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(map, 0, sizeof(map));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 | using namespace std;
a.cc:15:17: error: reference to 'count' is ambiguous
15 | count = 0;
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:9:5: note: 'int count'
9 | int count;
| ^~~~~
a.cc:27:33: error: reference to 'count' is ambiguous
27 | count = a + 1;
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:9:5: note: 'int count'
9 | int count;
| ^~~~~
a.cc:32:32: error: reference to 'count' is ambiguous
32 | printf("%d\n", count);
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:9:5: note: 'int count'
9 | int count;
| ^~~~~
|
s261302377 | p00467 | C++ | #include <stdio.h>
#include <algorithm>
int map[1234];
int derume[1234];
int N, M;
int now;
int count;
int buf;
int main(){
while (1){
memset(map, 0, sizeof(map));
memset(derume, 0, sizeof(derume));
now = 0;
count = 0;
scanf("%d%d", &N, &M);
if (N == 0 && M == 0) return 0;
for (int a = 0; a < N; a++){
scanf("%d", &map[a]);
}
for (int a = 0; a < M; a++){
scanf("%d", &derume[a]);
}
while (1){
now += derume[count];
now += map[now];
count++;
if (N - 1 <= now){
break;
}
}
printf("%d\n", count);
}
} | a.cc: In function 'int main()':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(map, 0, sizeof(map));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <algorithm>
+++ |+#include <cstring>
3 |
|
s521329142 | p00467 | C++ | #include <iostream>
using namespace std;
#define loop(i,n) for(int i=1;i<=n;i++)
int n,m;
int order[1002];
int dice[1002];
int solve(){
int pos=1;
loop(i,n)cin>>order[i];
loop(j,m)cin>>dice[j];
for(int t=1;t<=m;t++){
pos+=dice[t];
if(pos>=n)break;
pos+=order[pos];
if(pos>=n)break;
}
return t;
}
int main(){
cin>>n>>m;
while(n||m){
solve();
cin>>n>>m;
}
return 0;
} | a.cc: In function 'int solve()':
a.cc:19:10: error: 't' was not declared in this scope; did you mean 'tm'?
19 | return t;
| ^
| tm
|
s693209391 | p00467 | C++ | #include<iostream>
using namespace std;
int main(){
int N,M,masu[1000],dice[1000],now;
while(1){
cin >>N>>M;
if( N == 0 && M == 0)break;
now=1;
for(int i=1 ; i <= N ; i++)cin >>masu[i];
for(int i=1 ; i <= M ; i++)cin >>dice[i];
for(int i=1 ; i <= M ; i++){
now+=dice[i];
now+=masu[now];
if(now >= N)break;
}
cout <<i<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:12: error: 'i' was not declared in this scope
16 | cout <<i<<endl;
| ^
|
s059919489 | p00467 | C++ | using System;
public class Hello
{
public static void Main()
{
while (true)
{
string[] line = Console.ReadLine().Trim().Split(' ');
var n = int.Parse(line[0]);
var m = int.Parse(line[1]);
if (n == 0 && m == 0) break;
var a = new int[n];
for (int i = 0; i < n; i++)
a[i] = int.Parse(Console.ReadLine().Trim());
var p = 0;
var putans = false;
for (int i = 1; i <= m; i++)
{
var t = int.Parse(Console.ReadLine().Trim());
if (putans) continue;
if (p + t >= n - 1 || (p + t < n - 1 && a[p + t] + p + t >= n - 1)) { Console.WriteLine(i); putans = true; continue; }
p = a[p + t] + p + t;
}
}
}
}
| a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Hello
| ^~~~~~
|
s512873658 | p00467 | C++ | #include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (long long i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
int n,m;
int mas[1000],x[1000];
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
while(true) {
cin>>n>>m;
if(n==0&&m==0) break;
REP(i,1000) max[i]=x[i]=0;
REP(i,n) {
cin>>mas[i];
}
int pos=0;
REP(i,m) {
cin>>x[i];
}
REP(i,m) {
pos+=x[i]+mas[pos+x[i]];
if(pos>=n-1) {
cout<<i+1<<endl;
return 0;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:28:24: error: invalid types '<unresolved overloaded function type>[long long int]' for array subscript
28 | REP(i,1000) max[i]=x[i]=0;
| ^
|
s055616386 | p00467 | C++ | #include<iostream>
using namespace std;
int main()
{
for(;;){
int i, n, m, temp = 0, cont = 0
int ban[1000];
int me[1000];
cin >> n; //ツ全ツ閉板づ⒄ツマツス
cin >> m; //mツ嘉アツサツイツコツδ債づーツ振ツづゥ
if(n == 0 && m == 0){
break;
}
for(i = 0; i < n; i++){
cin >> ban[i];
}
for(i = 0; i < m; i++){
cin >> me[i];
}
for(i=0;;i++){
temp += me[i]+ban[temp];
cont++;
if(temp >= n){
break;
}
}
cout <<cont << endl;
}
}
| a.cc: In function 'int main()':
a.cc:9:17: error: expected ',' or ';' before 'int'
9 | int ban[1000];
| ^~~
a.cc:20:32: error: 'ban' was not declared in this scope
20 | cin >> ban[i];
| ^~~
a.cc:27:39: error: 'ban' was not declared in this scope
27 | temp += me[i]+ban[temp];
| ^~~
|
s177131401 | p00467 | C++ | #include<iostream>
#include<stdio.h>
int main(){/*
int s[9000],n,m,t,f,i;
while(std::cin>>n>>m&&n){
for(i=t=f=1;i<=n+m;i++){
std::cin>>s[i];
if(i>n){
if(t+=s[t+=s[i]]&t>=n&f==1){
std::cout<<i-n<<std::endl;
f=0;
}
}
}
}*//*
int s[9000],n,m,t,f,i;
while(scanf("%d%d",&n,&m)&&n){
for(i=t=f=1;i<=n+m;i++){
std::cin>>s[i];
if(i>n){
t+=s[i];
t+=s[t];
if(t>=n&f==1){
printf("%d\n",i-n);
f=0;
}
}
}
}*/
int s[9000],n,m,t,f,i;
while(std::cin>>n>>m&&n){
for(i=t=f=1;i<=n+m;i++){
std::cin>>s[i];
if(i>n){
if(t+=s[t+=s[i]]&t>=n&&f==1,!f=0){
std::cout<<i-n<<std::endl;
f=0;
}
}
}
}
} | a.cc: In function 'int main()':
a.cc:35:61: error: lvalue required as left operand of assignment
35 | if(t+=s[t+=s[i]]&t>=n&&f==1,!f=0){
| ^~
|
s943287516 | p00467 | C++ | #include<stdio.h>
int main(){
int n[1006]={0},m[1006]={0},k=0,i,N,M;
for(;;k=0){
scanf("%d%d",&N,&M);
if(M==0&&M==0)break;
for(i=0;i<N;i++){scanf("%d",&n[i]);
for(i=0;i<M;i++)scanf("%d",&m[i]);
for(i=0;;i++){
k+=m[i];
k+=n[k];
if(k>=N-1)break;
}
printf("%d\n",i+1);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:2: error: expected '}' at end of input
17 | }
| ^
a.cc:2:11: note: to match this '{'
2 | int main(){
| ^
|
s695561650 | p00467 | C++ | #include<stdio.h>
int main(){
int n[1006]={0},m[1006]={0},k=0,i,N,M;
for(;;k=0){
scanf("%d%d",&N,&M);
if(M==0)break;
for(i=0;i<N;i++)scanf("%d",&n[i]);
for(i=0;i<M;i++)scanf("%d",&m[i]);
for(i=0;;i++){
k+=m[i];
k+=n[k];
if(k>=N-1)break;
}
printf("%d\n",i+1);
}
exit(0);
} | a.cc: In function 'int main()':
a.cc:16:1: error: 'exit' was not declared in this scope
16 | exit(0);
| ^~~~
a.cc:2:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
1 | #include<stdio.h>
+++ |+#include <cstdlib>
2 | int main(){
|
s950958643 | p00467 | C++ | int main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),n)for(i=t=f=1;i<=n+m,scanf("%d",&s[i]);i++)if(i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i,f=0);} | a.cc: In function 'int main()':
a.cc:1:40: error: 'scanf' was not declared in this scope
1 | int main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),n)for(i=t=f=1;i<=n+m,scanf("%d",&s[i]);i++)if(i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i,f=0);}
| ^~~~~
a.cc:1:137: error: 'printf' was not declared in this scope
1 | int main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),n)for(i=t=f=1;i<=n+m,scanf("%d",&s[i]);i++)if(i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i,f=0);}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),n)for(i=t=f=1;i<=n+m,scanf("%d",&s[i]);i++)if(i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i,f=0);}
|
s932450934 | p00467 | C++ | main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),i=t=f=1,n)while(i<=n+m)if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i-n,f=0);i++;} | a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),i=t=f=1,n)while(i<=n+m)if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i-n,f=0);i++;}
| ^~~~
a.cc: In function 'int main()':
a.cc:1:36: error: 'scanf' was not declared in this scope
1 | main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),i=t=f=1,n)while(i<=n+m)if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i-n,f=0);i++;}
| ^~~~~
a.cc:1:131: error: 'printf' was not declared in this scope
1 | main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),i=t=f=1,n)while(i<=n+m)if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i-n,f=0);i++;}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | main(){int s[9000],n,m,t,f,i;while(scanf("%d%d",&n,&m),i=t=f=1,n)while(i<=n+m)if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)printf("%d\n",i-n,f=0);i++;}
|
s880749245 | p00467 | C++ | #include<stdio.h>
main(i){
int s[9000],n,m,t,f;
while(scanf("%d%d",&n,&m),i=0,t=f=1,n)
while(++i<=n+m)
if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)
printf("%d\n",i-n,f=0);
} | a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
2 | main(i){
| ^
|
s132925025 | p00467 | C++ | main(i){
int s[9000],n,m,t,f;
while(scanf("%d%d",&n,&m),i=0,t=f=1,n)
while(++i<=n+m)
if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],t>=n&f==1)
printf("%d\n",i-n,f=0);
} | a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
1 | main(i){
| ^
|
s227926693 | p00467 | C++ | main(i){int s[9000],n,m,t,f;while(scanf("%d%d",&n,&m),i=0,t=f=1,n)while(++i<=n+m)if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],f==t>=n)printf("%d\n",i-n,f=0);} | a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token
1 | main(i){int s[9000],n,m,t,f;while(scanf("%d%d",&n,&m),i=0,t=f=1,n)while(++i<=n+m)if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],f==t>=n)printf("%d\n",i-n,f=0);}
| ^
|
s072845687 | p00467 | C++ | #include<stdio.h>
main(i){
int s[9000],n,m,t,f;
while(scanf("%d%d",&n,&m),i=0,t=f=1,n)
while(i++<n+m)
if(scanf("%d",&s[i]),i>n&(t+=s[t+=s[i]],f==t>=n))
printf("%d\n",i-n,f=0);
} | a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
2 | main(i){
| ^
|
s558083956 | p00467 | C++ | #include<csdio>
int main(){
int n,m,j;
scanf("%d%d",&n,&m);
int ms[n],sg,b=0;
for(int i=0;i<n;i++) scanf("%d",&ms[i]);
for(j=0;j<m;j++){
scanf("%d",&sg);
b+=sg;
if(b>=m-1) break;
b+=ms[b];
if(b>=m-1) break;
}
printf("%d",j+1);
return 0;
} | a.cc:1:9: fatal error: csdio: No such file or directory
1 | #include<csdio>
| ^~~~~~~
compilation terminated.
|
s820408590 | p00467 | C++ | #include <iostream>
using namespace std;
int main()
{
int n[1000];
int s[1000];
int m,x,p=1;
while(true){
cin >> x >> m;
if(x==0)
break;
for(int i=1 ;i<=x ;i++){
cin >> s[i];
}
for(int i=1 ;i<=m ;i++){
cin >> n[i];
}
for(int i=1 ;i<=m ;i++){
p+=n[i];
if(p>=x){
cout << i << endl;
break;
}
p+=s[p];
if(p>=x){
cout << i << endl;
break;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:38:2: error: expected '}' at end of input
38 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s024591057 | p00467 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef vector<int> vint;
#define rep(i,n) for(int i = 0; i < n; i++)
int main()
{
ifstream ifs(stdin);
int n, m;
while(ifs >> n >> m && n)
{
int index = 0;
vint field(n);
rep(i, n) ifs >> field[i];
int res = 1;
for(;;res++)
{
int o;
ifs >> o;
if(n-1 <= index + o) break;
else index += o + field[index + o];
}
cout << res << endl;
}
} | a.cc: In function 'int main()':
a.cc:25:27: error: no matching function for call to 'std::basic_ifstream<char>::basic_ifstream(FILE*&)'
25 | ifstream ifs(stdin);
| ^
In file included from a.cc:18:
/usr/include/c++/14/fstream:619:9: note: candidate: 'template<class _Path, class _Require> std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const _Path&, std::ios_base::openmode) [with _Require = _Path; _CharT = char; _Traits = std::char_traits<char>]'
619 | basic_ifstream(const _Path& __s,
| ^~~~~~~~~~~~~~
/usr/include/c++/14/fstream:619:9: note: template argument deduction/substitution failed:
/usr/include/c++/14/fstream:64:60: error: request for member 'make_preferred' in 'std::declval<_IO_FILE*&>()', which is of pointer type '_IO_FILE*' (maybe you meant to use '->' ?)
64 | = decltype(std::declval<_Path&>().make_preferred().filename())>
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/c++/14/fstream:627:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(std::basic_ifstream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
627 | basic_ifstream(basic_ifstream&& __rhs)
| ^~~~~~~~~~~~~~
/usr/include/c++/14/fstream:627:39: note: no known conversion for argument 1 from 'FILE*' to 'std::basic_ifstream<char>&&'
627 | basic_ifstream(basic_ifstream&& __rhs)
| ~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/fstream:602:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const std::string&, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::string = std::__cxx11::basic_string<char>; std::ios_base::openmode = std::ios_base::openmode]'
602 | basic_ifstream(const std::string& __s,
| ^~~~~~~~~~~~~~
/usr/include/c++/14/fstream:602:41: note: no known conversion for argument 1 from 'FILE*' to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
602 | basic_ifstream(const std::string& __s,
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/fstream:569:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::ios_base::openmode]'
569 | basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
| ^~~~~~~~~~~~~~
/usr/include/c++/14/fstream:569:34: note: no known conversion for argument 1 from 'FILE*' to 'const char*'
569 | basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/fstream:558:7: note: candidate: 'std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char; _Traits = std::char_traits<char>]'
558 | basic_ifstream() : __istream_type(), _M_filebuf()
| ^~~~~~~~~~~~~~
/usr/include/c++/14/fstream:558:7: note: candidate expects 0 arguments, 1 provided
|
s557423926 | p00467 | C++ | #include <stdio.h>
int main(void)
{
int n, m;
int i, j;
int pd[1000];
int dd[1000];
int prog;
int ans;
while (1){
scanf("%d %d", &n, &m);
if (n == 0 && m == 0){
break;
}
for (i = 0; i < n; i++){
scanf("%d", &pd[i]);
}
for (i = 0; i < m; i++){
scanf("%d", &dd[i]);
}
prog = 0;
i = 0;
ans = 0;
while (prog < n){
prog += dd[i];
j = prog
prog += pd[j];
i++;
ans++;
}
printf("%d\n", ans);
}
return (0);
} | a.cc: In function 'int main()':
a.cc:31:33: error: expected ';' before 'prog'
31 | j = prog
| ^
| ;
32 | prog += pd[j];
| ~~~~
|
s486150774 | p00467 | C++ | 10 5
0
0
5
6
-3
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
1
5
2
4
6
5
5
4
1
6
0 0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 10 5
| ^~
|
s001649653 | p00468 | Java | import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;
public class _0545_Party {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
while(true){
int n = Integer.parseInt(scan.next());
int m = Integer.parseInt(scan.next());
if(n==0) break;
V[] ver = new V[n];
for (int i = 0; i < n; i++) ver[i] = new V();
boolean[] used = new boolean[n];
for (int i = 0; i < m; i++) {
int a = Integer.parseInt(scan.next())-1;
int b = Integer.parseInt(scan.next())-1;
ver[a].to.add(b);
ver[b].to.add(a);
}
Stack<int[]> stk = new Stack<int[]>();
stk.push(new int[]{0,0});
used[0]=true;
int ans = 0;
while(!stk.isEmpty()){
int[] p = stk.pop();
int num = p[0],deep = p[1];
ans++;
if(deep!=2) for (Integer i : ver[num].to) {
if(!used[i]){
used[i]=true;
stk.push(new int[]{i,deep+1});
}
}
}
out.println(ans-1);
}
out.flush();
}
}
class V{
HashSet<Integer> to = new HashSet<Integer>();
} | Main.java:7: error: class _0545_Party is public, should be declared in a file named _0545_Party.java
public class _0545_Party {
^
1 error
|
s499775475 | p00468 | C | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int,int> P; //cost,node
struct node{
vector<int> et;
int size;
}*f;
int cost[500];
void BFS(int start ){
queue<P> que;
P now;
que.push( P(0,0) );
while( !que.empty() ){
now = que.front();
que.pop();
if( cost[now.second] != 10000 )
continue;
cost[now.second] = now.first;
node *no = &f[now.second];
for( int i = 0;i < no->size;i++ ){
que.push( P(now.first+1,no->et[i]) );
}
}
}
int main(){
int N,M,a,b,i;
int ans;
while(1){
cin >> N >> M;
if( !N )break;
f = new node[500];
ans = 0;
for( i = 0;i < N;i++ ){
cost[i] = 10000;
}
for( i = 0;i < M;i++ ){
cin >> a >> b;
a--;b--;
f[a].et.push_back(b);
f[b].et.push_back(a);
f[a].size++;
f[b].size++;
}
BFS( 0 );
for( i = 1;i < N;i++ ){
if( cost[i] <= 2 )
ans++;
}
cout << ans << endl;
delete[] f;
}
return 0;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s751500902 | p00468 | C | #include<stdio.h>
#include<string.h>
char gouh[501];
char kankei[501][501];
int main(void){
int n,m,i,sasou,k;
while(1){
scanf("%d%d",&n,&m);
if(!n && !m)break;
memset(gouh,0,sizeof(gouh));
memset(kankei,0,sizeof(kankei));
for(i=0;i<m;i++){
scanf("%d%d",&j,&k);
kankei[j][k]=kankei[k][j]=1;
}
for(i=2;i<=n;i++){
if(kankei[1][i]==1){
gouh[i]=1;
for(j=1;j<=n;j++){
if(kankei[i][j]==1) gouh[j]=1;
}
}
}
sasou=0;
for(i=2;i<=n;i++){
if(gouh[i]==1) sasou++;
}
printf("%d\n",sasou);
}
return 0;
} | main.c: In function 'main':
main.c:15:39: error: 'j' undeclared (first use in this function)
15 | scanf("%d%d",&j,&k);
| ^
main.c:15:39: note: each undeclared identifier is reported only once for each function it appears in
|
s534498850 | p00468 | C | 100
500
24 40
17 20
73 77
38 46
31 47
11 66
21 65
79 99
11 29
34 42
18 93
44 65
13 50
2 50
66 86
56 77
13 40
23 67
62 89
40 99
41 90
37 66
13 100
30 64
40 49
38 87
39 51
43 66
22 37
45 90
32 34
41 87
7 23
12 63
9 57
61 93
40 71
51 57
13 33
21 37
18 44
55 72
82 91
3 15
57 89
6 46
54 58
6 41
7 59
2 29
1 48
17 94
3 20
13 18
23 90
18 69
10 23
77 97
52 93
22 83
73 89
96 100
47 74
60 75
29 38
68 86
29 75
6 21
16 37
22 23
44 60
78 87
28 92
57 58
38 71
31 98
68 79
15 22
88 90
21 74
12 89
60 79
2 4
18 21
45 48
62 77
48 98
42 70
7 54
35 54
49 97
31 94
13 74
8 61
39 47
80 90
29 58
1 95
38 57
32 77
24 39
4 34
34 41
21 98
21 38
29 69
13 25
6 13
33 51
23 72
19 38
18 66
63 78
9 97
59 72
34 36
7 12
27 45
16 19
37 47
88 91
77 95
23 87
6 93
66 93
41 67
61 94
44 100
33 55
4 70
65 86
38 64
17 71
67 90
48 95
17 68
45 53
79 82
41 60
19 74
11 88
7 38
13 16
11 56
47 76
25 85
76 99
19 77
70 89
30 32
1 87
18 26
67 81
47 54
22 99
89 96
16 60
28 69
69 99
18 45
86 94
11 68
88 89
41 61
35 53
8 43
34 71
32 67
12 77
13 36
21 41
25 93
21 32
45 67
58 98
77 99
34 90
50 54
73 100
25 83
16 35
45 86
31 88
31 74
48 63
25 88
17 61
29 70
59 62
58 81
17 65
18 62
71 76
6 98
68 81
40 62
24 28
21 96
43 57
23 47
22 44
41 54
67 76
1 99
1 18
7 27
6 43
52 58
50 59
18 38
22 25
17 46
47 75
85 96
7 52
83 89
5 38
9 58
27 33
33 54
65 96
7 63
38 52
12 16
6 82
30 69
28 52
34 50
2 97
63 68
58 75
28 73
8 85
9 47
1 3
52 77
7 60
39 70
12 86
38 98
40 41
23 78
47 63
32 63
12 92
43 92
8 20
47 69
36 59
2 21
13 43
44 56
40 80
53 84
65 72
77 81
24 91
9 91
12 30
31 96
2 77
44 79
40 69
27 98
4 25
19 92
77 96
66 75
22 85
80 100
17 90
28 70
15 47
68 74
14 43
19 60
82 93
22 31
6 97
12 32
34 35
31 72
79 89
29 49
76 86
45 94
24 43
23 68
38 76
25 76
13 17
31 49
72 75
5 19
7 66
62 87
62 71
29 54
43 46
35 83
32 78
9 64
87 97
4 32
69 70
52 99
5 60
94 96
38 74
48 96
78 92
21 42
19 64
22 40
8 88
19 84
11 77
58 99
16 77
43 59
27 59
1 28
70 78
14 27
71 95
1 24
53 89
6 20
48 67
74 99
41 96
24 29
34 66
13 23
4 68
51 80
18 29
55 58
47 92
17 93
3 98
3 22
11 55
22 62
13 39
34 72
30 34
3 23
1 63
62 85
47 100
9 74
10 78
60 76
41 97
55 86
29 91
31 60
46 82
34 98
53 90
43 75
14 54
37 55
26 66
36 74
10 22
15 91
14 62
66 78
52 68
56 80
18 68
8 12
32 86
9 70
95 97
25 52
31 75
6 59
17 78
7 93
9 76
14 39
24 47
25 73
27 77
24 85
9 53
38 63
31 99
21 66
66 76
33 85
20 84
40 96
33 83
14 35
36 53
40 65
13 14
22 79
34 76
1 84
2 59
12 23
23 28
22 46
54 67
55 57
69 72
1 100
74 87
20 33
24 48
6 70
8 94
32 100
1 65
74 91
27 81
23 99
7 11
7 86
27 52
22 77
6 42
16 97
15 19
62 96
28 31
10 63
40 84
33 91
79 90
13 87
44 72
19 71
51 55
1 62
70 74
20 89
28 48
27 35
8 73
39 95
41 83
28 75
45 54
73 81
27 90
30 77
20 46
42 65
5 66
60 98
7 64
7 57
31 32
26 54
4 20
61 68
7 74
60 94
37 70
14 89
46 67
58 93
37 60
11 33
25 71
7 15
16 67
14 75
8 56
36 81
13 63
35 51
76 89
5 87
19 59
5 56
9 14
33 81
17 56
9 63
62 94
25 87
13 46
15 96
39 92
2 20
58 67
20 78
66 73
23 81
55 84
37 87
22 61
17 44 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 100
| ^~~
|
s596501871 | p00468 | C | #include<stdio.h>
int a[10000],b[10000];
int main(void)
{
int n,k,i,,c,x[501];
while(1){
c=0;
scanf("%d",&n);
scanf("%d",&k);
if(n==0&&k==0){
break;
}
for(i=0;i<=n;i++){
a[i]=0;
b[i]=0;
x[i]=0;
}
x[1]=1;
for(i=0;i<k;i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i]==1){
x[b[i]]=1;
c++;
}
}
for(i=0;i<k;i++){
if(x[a[i]]==1&&x[b[i]]==0){
x[b[i]]=3;
c++;
}
if(x[b[i]]==1&&x[a[i]]==0){
x[a[i]]=3;
c++;
}
}
printf("%d\n",c);
}
return 0;
} | main.c: In function 'main':
main.c:5:11: error: expected identifier or '(' before ',' token
5 | int n,k,i,,c,x[501];
| ^
main.c:7:17: error: 'c' undeclared (first use in this function)
7 | c=0;
| ^
main.c:7:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:25: error: 'x' undeclared (first use in this function)
16 | x[i]=0;
| ^
|
s708663654 | p00468 | C | #include<stdio.h>
int main(void)
{
int n,m,i,cnt=0,flag[10001]={0},a[10001],b[10001];
scanf("%d %d",&n,&m);
for(i = 0; i < m; i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i] ==1)
flag[b[i]] = 1;
}
for(i = 0; i < m; i++){
if(flag[a[i]] == 1 && flag[b[i]] == 0;
flag[b[i]] = 2;
if(flag[a[i]] == 0 && flag[b[i]] == 1)
flag[a[i]] = 2;
for(i = 2; i <= m; i++){
if(flag[i])cnt++;
}
printf("%d\n",cnt);
return 0;
} | main.c: In function 'main':
main.c:17:54: error: expected ')' before ';' token
17 | if(flag[a[i]] == 1 && flag[b[i]] == 0;
| ~ ^
| )
main.c:29:1: error: expected expression before '}' token
29 | }
| ^
main.c:29:1: error: expected declaration or statement at end of input
|
s026329189 | p00468 | C | #include<stdio.h>
int main()
{
int n,m,i,cnt,flag[501],a[10001],b[10001];
while(1){
for(i=0;i<=500;i++)
flag[i]={0};cnt=0;
scanf("%d %d",&n,&m);
if(n==0&&m==0) break;
for(i = 0; i < m; i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i] ==1)
flag[b[i]] = 1;
}
for(i = 0; i < m; i++){
if(flag[a[i]] == 1 && flag[b[i]] == 0){
flag[b[i]] = 2;
}
if(flag[a[i]] == 0 && flag[b[i]] == 1){
flag[a[i]] = 2;
}
}
for(i = 2; i <= m; i++){
if(flag[i])cnt++;
}
printf("%d\n",cnt);
}
return 0;
} | main.c: In function 'main':
main.c:8:25: error: expected expression before '{' token
8 | flag[i]={0};cnt=0;
| ^
|
s865692271 | p00468 | C | #include<stdio.h>
int main()
{
int n,m,i,cnt,flag[501],a[10001],b[10001];
while(1){
for(i=0;i<=500;i++){
flag[i]={0};
cnt=0;
}
scanf("%d %d",&n,&m);
if(n == 0 && m == 0)
break;
for(i = 0; i < m; i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i] ==1)
flag[b[i]] = 1;
}
for(i = 0; i < m; i++){
if(flag[a[i]] == 1 && flag[b[i]] == 0){
flag[b[i]] = 2;
}
if(flag[a[i]] == 0 && flag[b[i]] == 1){
flag[a[i]] = 2;
}
}
for(i = 2; i <= m; i++){
if(flag[i])cnt++;
}
printf("%d\n",cnt);
}
return 0;
} | main.c: In function 'main':
main.c:9:33: error: expected expression before '{' token
9 | flag[i]={0};
| ^
|
s491511922 | p00468 | C | #include<stdio.h>
int main(void)
{
int n,m,a[1000],b[1000],f[1000]={0},z,i;
scanf("%d",&n);
while(n!=0){
scanf("%d",&m);
for(i=0;i<m;i++){
a[i]=0:
b[i]=0;
z=0;
for(i=0;i<m;i++){
scanf("%d %d",&a[i],&b[i]);
}
for(i=0;i<m;i++){
if(1==a[i]){
f[b[i]]=1;
f[a[i]]=1;
z=z+1;
}
}
for(i=0;i<m;i++){
if(f[a[i]]==1 && f[b[i]]==0){
f[b[i]]=2;
z=z+1;
}
if(f[a[i]]==0 && f[b[i]]==1){
f[a[i]]=2;
z=z+1;
}
}
scanf("%d",&n);
}
printf("%d\n",z);
return 0;
} | main.c: In function 'main':
main.c:9:15: error: expected ';' before ':' token
9 | a[i]=0:
| ^
| ;
main.c:36:1: error: expected declaration or statement at end of input
36 | }
| ^
|
s382062177 | p00468 | C | #include<stdio.h>
int main(void)
{
int n,m,a[1000],b[1000],f[1000]={0},z,i;
scanf("%d",&n);
while(n!=0){
scanf("%d",&m);
for(i=0;i<m;i++){
a[i]=0:
b[i]=0;
}
for(i=0;i<m;i++){
scanf("%d %d",&a[i],&b[i]);
}
for(i=0;i<m;i++){
if(1==a[i]){
f[b[i]]=1;
f[a[i]]=1;
z=z+1;
}
}
for(i=0;i<m;i++){
if(f[a[i]]==1 && f[b[i]]==0){
f[b[i]]=2;
z=z+1;
}
if(f[a[i]]==0 && f[b[i]]==1){
f[a[i]]=2;
z=z+1;
}
}
scanf("%d",&n);
}
printf("%d\n",z);
return 0;
} | main.c: In function 'main':
main.c:9:15: error: expected ';' before ':' token
9 | a[i]=0:
| ^
| ;
|
s044854319 | p00468 | C | #include<stdio.h>
int main(void)
{
int n,m,a[1000],b[1000],f[1000]={0},z,i;
scanf("%d",&n);
while(n!=0){
scanf("%d",&m);
for(i=0;i<m;i++){
a[i]=0:
b[i]=0;
for(i=0;i<m;i++){
scanf("%d %d",&a[i],&b[i]);
}
for(i=0;i<m;i++){
if(1==a[i]){
f[b[i]]=1;
f[a[i]]=1;
z=z+1;
}
}
for(i=0;i<m;i++){
if(f[a[i]]==1 && f[b[i]]==0){
f[b[i]]=2;
z=z+1;
}
if(f[a[i]]==0 && f[b[i]]==1){
f[a[i]]=2;
z=z+1;
}
}
}
scanf("%d",&n);
}
printf("%d\n",z);
return 0;
} | main.c: In function 'main':
main.c:9:15: error: expected ';' before ':' token
9 | a[i]=0:
| ^
| ;
|
s533866387 | p00468 | C | #include<stdio.h>
int main(void)
{
int n,m,a[1000],b[1000],f[1000]={0},z,i;
scanf("%d",&n);
while(n!=0){
scanf("%d",&m);
for(i=0;i<m;i++){
a[i]=0:
b[i]=0;
f[i]=0;
for(i=0;i<m;i++){
scanf("%d %d",&a[i],&b[i]);
}
for(i=0;i<m;i++){
if(1==a[i]){
f[b[i]]=1;
f[a[i]]=1;
z=z+1;
}
}
for(i=0;i<m;i++){
if(f[a[i]]==1 && f[b[i]]==0){
f[b[i]]=2;
z=z+1;
}
if(f[a[i]]==0 && f[b[i]]==1){
f[a[i]]=2;
z=z+1;
}
}
}
scanf("%d",&n);
}
printf("%d\n",z);
return 0;
} | main.c: In function 'main':
main.c:9:15: error: expected ';' before ':' token
9 | a[i]=0:
| ^
| ;
|
s676916458 | p00468 | C | #include <stdio.h>
#include <string>
int n, m, a[11234], b[11234];
int my_friends[11234], their_friends[11234];
int tmp = 0, ans = 0;
bool cancel = false;
int main(void) {
scanf("%d%d", &n, &m);
for (int i = 0; i < m; ++i) { scanf("%d%d", &a[i], &b[i]); }
memset(my_friends, -1, sizeof(my_friends));
memset(their_friends, -1, sizeof(their_friends));
for (int i = 0; i < m; ++i) {
if (a[i] == 1) { my_friends[b[i] - 1] = b[i]; tmp++; }
}
ans = tmp;
for (int i = 0; i < m; ++i) {
for (int j = 0; j <= tmp; ++j) {
if (a[i] == my_friends[j]) {
for (int k = 0; k < n; ++k) {
if (b[i] == my_friends[k] || b[i] == their_friends[k]) {
cancel = true;
break;
}
}
if (cancel == false) { their_friends[b[i] - 1] = b[i]; ans++; }
cancel = false;
}
}
}
printf("%d\n", ans);
return 0;
} | main.c:2:10: fatal error: string: No such file or directory
2 | #include <string>
| ^~~~~~~~
compilation terminated.
|
s938616058 | p00468 | C | #include <stdio.h>
int main()
{
int n[501];
int L[10000][2];
int n, m, F[500], invite = 0;
int i, j, k, q;
while (1) {
scanf("%d %d", &n, &m);
if (n == 0 && m == 0)break;
for (i = 0;i < m;i++) {
scanf("%d %d", &L[i][0], &L[i][1]);
if (L[i][0] == 1) {
j = 0;
F[j] = L[i][1];
invite++;j++;
}
}
for (i = 0;i < m;i++) {
for (j = 0;j < invite;j++) {
if (L[i][0] == F[j]) {
for (q = 0;q < invite;q++) {
if (F[q] == L[i][2]) {
break;
}
else invite++;
}
}
}
}
printf("%d\n", invite);
}
return 0;
} | main.c: In function 'main':
main.c:8:13: error: conflicting types for 'n'; have 'int'
8 | int n, m, F[500], invite = 0;
| ^
main.c:6:13: note: previous declaration of 'n' with type 'int[501]'
6 | int n[501];
| ^
|
s762936906 | p00468 | C | #include <stdio.h>
int main(void){
int i,j,n,m,ans=0;
scanf("%d %d",&n,&m);
int a[m],b[m],student[n+1];
for(i=1;i<=n;i++){
student[i]=0;
}
for(i=1;i<=m;i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i]==1)student[b[i]]=1;
if(b[i]==1)student[a[i]]=1;
}
for(i=1;i<=m;i++){
if(student[a[i]]==1&&student[b[i]]=0)student[b[i]]=2;
if(student[b[i]]==1&&student[a[i]]=0)student[a[i]]=2;
}
for(i=2;i<=n;i++){
if(student[i]==1||student[i]==2)ans++;
}
printf("%d\n",ans);
return 0;
} | main.c: In function 'main':
main.c:17:51: error: lvalue required as left operand of assignment
17 | if(student[a[i]]==1&&student[b[i]]=0)student[b[i]]=2;
| ^
main.c:18:51: error: lvalue required as left operand of assignment
18 | if(student[b[i]]==1&&student[a[i]]=0)student[a[i]]=2;
| ^
|
s373697674 | p00468 | C | #include <stdio.h>
#define YARIMASUNE 114514
int i,j;
int a,b,n,m,sum=0;
int f[YARIMASUNE][YARIMASUNE],p[YARIMASUNE],ans[YARIMASUNE];
#define str int main(){
#define END return 0;}
#define MUGEN for(;;){
#define YAJU_OWATA if(n==0&&m==0){break;}
#define output printf("%d\n",sum);}
#define input "%d%d"
#define A_mai a-1
#define B_mai b-1
#define KIMOCHI if ((p I == 1) && (f I [j] == 1 || f[j] I == 1)){ans[j] = 1;}
#define Ni for (i = 0; i < n; i++){
#define plus ++
#define I [i]
#define J [j]
#define FO for(i = 1; i < n; i plus){for (j = 1; j < n; j plus){
#define answer sum += ans I;
#define ZERO 0
#define ONE 1
str
MUGEN
scanf(input, &n, &m);
YAJU_OWATA
Ni
p I = ZERO;
ans I = ZERO;
for (j = ZERO; j < 510; j plus){
f I J = ZERO;
}}
for (i = ZERO; i < m; i plus){
scanf(input, &a, &b);
f[A_mai][B_mai] = ONE;
if (a == ONE){
p[B_mai] = ONE;
ans[B_mai] = ONE;
}}
FO
KIMOCHI
}}
Ni
answer
}
output
END
| /tmp/cc517mHZ.o: in function `main':
main.c:(.text+0x66): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc517mHZ.o
main.c:(.text+0x84): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc517mHZ.o
main.c:(.text+0x19a): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc517mHZ.o
main.c:(.text+0x1bb): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc517mHZ.o
main.c:(.text+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc517mHZ.o
main.c:(.text+0x2a1): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc517mHZ.o
main.c:(.text+0x311): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc517mHZ.o
collect2: error: ld returned 1 exit status
|
s190244803 | p00468 | C | #include <stdio.h>
#define YARIMASUNE 114514
int i,j;
int a,b,n,m,sum=0;
int f[YARIMASUNE][YARIMASUNE],p[YARIMASUNE],ans[YARIMASUNE];
#define str int main(){
#define END return 0;}
#define MUGEN for(;;){
#define YAJU_OWATA if(n==0&&m==0){break;}
#define output printf("%d\n",sum);}
#define input "%d%d"
#define A_mai a-1
#define B_mai b-1
#define KIMOCHI if ((p I == 1) && (f I [j] == 1 || f[j] I == 1)){ans[j] = 1;}
#define Ni for (i = 0; i < n; i++){
#define plus ++
#define I [i]
#define J [j]
#define FO for(i = 1; i < n; i plus){for (j = 1; j < n; j plus){
#define answer sum += ans I;
#define ZERO 0
#define ONE 1
str
MUGEN
scanf(input, &n, &m);
YAJU_OWATA
Ni
p I = ZERO;
ans I = ZERO;
for (j = ZERO; j < 510; j plus){
f I J = ZERO;
}}
for (i = ZERO; i < m; i plus){
scanf(input, &a, &b);
f[A_mai][B_mai] = ONE;
if (a == ONE){
p[B_mai] = ONE;
ans[B_mai] = ONE;
}}
FO
KIMOCHI
}}
Ni
answer
}
output
END
| /tmp/cc1UqMNv.o: in function `main':
main.c:(.text+0x66): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1UqMNv.o
main.c:(.text+0x84): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc1UqMNv.o
main.c:(.text+0x19a): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1UqMNv.o
main.c:(.text+0x1bb): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc1UqMNv.o
main.c:(.text+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1UqMNv.o
main.c:(.text+0x2a1): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc1UqMNv.o
main.c:(.text+0x311): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc1UqMNv.o
collect2: error: ld returned 1 exit status
|
s411223681 | p00468 | C | int main(){
while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;
scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d %d",&a,&b); if(a==1){ num[b]++;}c[a][b]++;
c[b][a]++;} for(i=1;i<=n;i++){for(j=1;j<=n;j++){
if(c[1][i]==1 && c[i][j]==1){num[j]++;}}}
for(i=2;i<=n;i++){if(num[i]!=0) sum++;}
printf("%d\n",sum);return 0;} | main.c: In function 'main':
main.c:3:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
3 | scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d %d",&a,&b); if(a==1){ num[b]++;}c[a][b]++;
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(){
main.c:3:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
3 | scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d %d",&a,&b); if(a==1){ num[b]++;}c[a][b]++;
| ^~~~~
main.c:3:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
7 | printf("%d\n",sum);return 0;}
| ^~~~~~
main.c:7:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:7:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:1: error: expected declaration or statement at end of input
|
s904754641 | p00468 | C | while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d%d",&a,&b); if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0) sum++;}printf("%d\n",sum);}return 0;} | main.c:1:1: error: expected identifier or '(' before 'while'
1 | while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d%d",&a,&b); if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0) sum++;}printf("%d\n",sum);}return 0;}
| ^~~~~
main.c:1:319: error: expected identifier or '(' before 'return'
1 | while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d%d",&a,&b); if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0) sum++;}printf("%d\n",sum);}return 0;}
| ^~~~~~
main.c:1:328: error: expected identifier or '(' before '}' token
1 | while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m); if(n==0) break; for(i=1;i<=m;i++){scanf("%d%d",&a,&b); if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0) sum++;}printf("%d\n",sum);}return 0;}
| ^
|
s083324139 | p00468 | C | while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m);if(n==0)break;for(i=1;i<=m;i++){scanf("%d%d",&a,&b);if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0)sum++;}printf("%d\n",sum);}; | main.c:1:1: error: expected identifier or '(' before 'while'
1 | while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m);if(n==0)break;for(i=1;i<=m;i++){scanf("%d%d",&a,&b);if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0)sum++;}printf("%d\n",sum);};
| ^~~~~
|
s344395141 | p00468 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b,i,a1[1000],a2[1000],cnt=0,cc[1000],k,h,cntmark2=0;
cin>>a;
cin>>b;
for(i=0;i<b;i++){
cin>>a1[i]>>a2[i];
}
int j=0;
for(i=0;i<b;i++){
if(a1[i]==1||a2[i]==1){
if(a1[i]==1){
cc[j]=a2[i];
cnt++;
}else{
cc[j]=a1[i];
cnt++;
}
j++;
}
}
cout<<cnt<<endl;
int sihyou=j;
//友達の友達
for(i=0;i<b;i++){
k=0;
for(j=0;j<=sihyou;j++){
if(cc[j]==a1[i]&&a2[i]!=1||cc[j]==a2[i]&&a1[i]!=1){
if(cc[j]==a1[i]){
if(a1[i]!=1){
for(h=0;h<sihyou;h++){
if(a2[i]!=cc[h])
cntmark2++;
}
if(cntmark2==sihyou)
cnt++;
}
}else{
if(a2[i]!=1){
for(h=0;h<sihyou;h++){
if(a1[i]!=cc[h])
cntmark2++;
}
if(cntmark2==sihyou)
cnt++;
}
cntmark2=0;
k++;
}
}
if(k==1) break;
}
}
cout<<cnt<<endl;
return 0; | a.cc: In function 'int main()':
a.cc:65:18: error: expected '}' at end of input
65 | return 0;
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s420257424 | p00468 | C++ | 50
200
24 40
17 20
23 27
38 46
31 47
11 16
15 21
29 49
11 29
34 42
18 43
15 44
13 50
2 50
16 36
6 27
13 40
17 23
12 39
40 49
40 41
16 37
14 30
37 38
1 39
16 43
22 37
40 45
32 34
37 41
7 23
12 13
7 9
11 43
21 40
1 7
13 33
21 37
18 44
5 22
32 41
3 15
7 39
6 46
4 8
6 41
2 29
1 48
17 44
3 20
13 18
23 40
18 19
10 23
27 47
2 43
22 33
23 39
46 50
24 47
10 25
29 38
18 36
25 29
6 21
22 23
10 44
28 37
28 42
7 8
21 38
31 48
18 29
15 22
38 40
21 24
10 29
2 4
18 21
45 48
12 27
20 42
4 7
4 35
47 49
31 44
13 24
8 11
39 47
30 40
8 29
1 45
7 38
27 32
24 39
4 34
34 41
21 48
19 29
13 25
6 13
1 33
19 38
16 18
13 28
9 47
9 22
34 36
7 12
27 45
16 19
37 47
38 41
23 37
6 43
17 41
11 44
44 50
5 33
4 20
15 36
14 38
17 21
17 40
17 18
3 45
29 32
10 41
19 24
11 38
13 16
6 11
26 47
25 35
26 49
19 27
20 39
30 32
1 37
18 26
17 31
4 47
22 49
39 46
10 16
19 28
19 49
18 45
36 44
11 18
38 39
11 41
3 35
8 43
21 34
17 32
13 36
21 41
25 43
21 32
17 45
8 48
27 49
34 40
4 50
23 50
25 33
16 35
36 45
31 38
24 31
13 48
25 38
11 17
20 29
9 12
8 31
15 17
12 18
21 26
6 48
18 31
12 40
24 28
21 46
7 43
23 47
22 44
4 41
17 26
1 49
1 18
7 27
2 8
9 50
18 38
22 25
17 46
25 47
35 46 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 50
| ^~
|
s222569507 | p00468 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
partial class Program
{
static void Main()
{
for (; ; )
{
int n = int.Parse(Console.ReadLine());
int m = int.Parse(Console.ReadLine());
if (n == 0)
return;
bool[,] friend = new bool[n + 1, n + 1];
for (int i = 0; i < m; i++)
{
string[] input = Console.ReadLine().Split();
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
friend[a, b] = true;
friend[b, a] = true;
}
bool[] friendfriend = new bool[n + 1];
for (int i = 0; i < n + 1; i++)
{
if (friend[1, i] == true)
{
friendfriend[i] = true;
for (int j = 2; j < n + 1; j++)
{
if (friend[i, j] == true)
friendfriend[j] = true;
}
}
}
int answer = 0;
for (int i = 2; i < n + 1; i++)
{
if (friendfriend[i] == true)
answer++;
}
Console.WriteLine(answer);
}
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:6:1: error: 'partial' does not name a type
6 | partial class Program
| ^~~~~~~
|
s124383549 | p00468 | C++ | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
static void Main()
{
for (; ; )
{
int n = int.Parse(Console.ReadLine());
int m = int.Parse(Console.ReadLine());
if (n == 0)
return;
bool[,] friend = new bool[n + 1, n + 1];
for (int i = 0; i < m; i++)
{
string[] input = Console.ReadLine().Split();
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
friend[a, b] = true;
friend[b, a] = true;
}
bool[] friendfriend = new bool[n + 1];
for (int i = 0; i < n + 1; i++)
{
if (friend[1, i] == true)
{
friendfriend[i] = true;
for (int j = 2; j < n + 1; j++)
{
if (friend[i, j] == true)
friendfriend[j] = true;
}
}
}
int answer = 0;
for (int i = 2; i < n + 1; i++)
{
if (friendfriend[i] == true)
answer++;
}
Console.WriteLine(answer);
}
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:52:2: error: expected ';' after class definition
52 | }
| ^
| ;
a.cc: In static member function 'static void Program::Main()':
a.cc:12:21: error: expected primary-expression before 'int'
12 | int n = int.Parse(Console.ReadLine());
| ^~~
a.cc:13:21: error: expected primary-expression before 'int'
13 | int m = int.Parse(Console.ReadLine());
| ^~~
a.cc:18:18: error: expected identifier before ',' token
18 | bool[,] friend = new bool[n + 1, n + 1];
| ^
a.cc:18:18: error: expected ']' before ',' token
a.cc:18:17: error: structured binding declaration cannot have type 'bool'
18 | bool[,] friend = new bool[n + 1, n + 1];
| ^
a.cc:18:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:18:17: error: empty structured binding declaration
a.cc:18:21: error: expected initializer before 'friend'
18 | bool[,] friend = new bool[n + 1, n + 1];
| ^~~~~~
a.cc:21:17: error: 'string' was not declared in this scope
21 | string[] input = Console.ReadLine().Split();
| ^~~~~~
a.cc:21:24: error: expected primary-expression before ']' token
21 | string[] input = Console.ReadLine().Split();
| ^
a.cc:22:25: error: expected primary-expression before 'int'
22 | int a = int.Parse(input[0]);
| ^~~
a.cc:23:25: error: expected primary-expression before 'int'
23 | int b = int.Parse(input[1]);
| ^~~
a.cc:25:17: error: 'friend' used outside of class
25 | friend[a, b] = true;
| ^~~~~~
| ------
a.cc:25:23: error: ISO C++ forbids declaration of 'structured binding' with no type [-fpermissive]
25 | friend[a, b] = true;
| ^~~~~~
a.cc:25:23: error: structured binding declaration cannot have type 'int'
a.cc:25:23: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:25:24: error: conflicting declaration 'auto a'
25 | friend[a, b] = true;
| ^
a.cc:22:21: note: previous declaration as 'int a'
22 | int a = int.Parse(input[0]);
| ^
a.cc:25:27: error: conflicting declaration 'auto b'
25 | friend[a, b] = true;
| ^
a.cc:23:21: note: previous declaration as 'int b'
23 | int b = int.Parse(input[1]);
| ^
a.cc:26:17: error: 'friend' used outside of class
26 | friend[b, a] = true;
| ^~~~~~
| ------
a.cc:26:23: error: ISO C++ forbids declaration of 'structured binding' with no type [-fpermissive]
26 | friend[b, a] = true;
| ^~~~~~
a.cc:26:23: error: structured binding declaration cannot have type 'int'
a.cc:26:23: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:26:24: error: conflicting declaration 'auto b'
26 | friend[b, a] = true;
| ^
a.cc:23:21: note: previous declaration as 'int b'
23 | int b = int.Parse(input[1]);
| ^
a.cc:26:27: error: conflicting declaration 'auto a'
26 | friend[b, a] = true;
| ^
a.cc:22:21: note: previous declaration as 'int a'
22 | int a = int.Parse(input[0]);
| ^
a.cc:29:17: error: structured binding declaration cannot have type 'bool'
29 | bool[] friendfriend = new bool[n + 1];
| ^~
a.cc:29:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:29:17: error: empty structured binding declaration
a.cc:29:20: error: expected initializer before 'friendfriend'
29 | bool[] friendfriend = new bool[n + 1];
| ^~~~~~~~~~~~
a.cc:32:21: error: 'friend' used outside of class
32 | if (friend[1, i] == true)
| ^~~~~~
| ------
'
a.cc:32: confused by earlier errors, bailing out
|
s444564421 | p00468 | C++ | // AOJ 0545
#include<cstdio>
#include<vector>
#define rep(i,a) for( int i = 0; i != (a); ++i )
#define repi(i,a,b) for( int i = (a); i != (b); ++i )
int n, m;
std::vector<int> G[500];
bool used[500];
void dfs( int d, int v )
{
used[v] = true;
if( !d )
return;
rep( i, G[v].size() )
dfs( d-1, G[v][i] );
return;
}
int main()
{
while( scanf( "%d%d", &n, &m ), n|m )
{
memset( used, false, sizeof( used ) );
rep( i, 500 )
G[i].clear();
rep( i, m )
{
int a, b;
scanf( "%d%d", &a, &b );
--a; --b;
G[a].push_back( b );
G[b].push_back( a );
}
dfs( 2, 0 );
int ans = 0;
repi( i, 1, n )
ans += used[i];
printf( "%d\n", ans );
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:17: error: 'memset' was not declared in this scope
28 | memset( used, false, sizeof( used ) );
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<vector>
+++ |+#include <cstring>
4 | #define rep(i,a) for( int i = 0; i != (a); ++i )
|
s705983835 | p00468 | C++ | #include<iostream>
using namespace std;
int n,m;
int tTot(int* N,int b){//印をつけた人
int c;
for(int i=0;i<m;i++){
if(N[i]==1){
if(i==b)c=1;
}
}
if(c==1)return 1;
else return 0;
}
int main(){
int N[500]={0};//招待された生徒に印をつける
int a[1000],b[1000];//リストの情報
int count=0;
while(true){
cin>>n>>m;//nが1から始めるので、1ひいて0から始める。
if(n==0&&m=0)break;
for(int i=0;i<m;i++){
int ak,bk;
cin>>ak>>bk;
a[i]=ak-1;b[i]=bk-1;
}
for(int i=0;i<m;i++){
if(a[i]==0){//aが番0だったら
N[b[i]]=1;//bに印をつける
}
}
//上まではOK
for(int i=0;i<m;i++){
if(tTot(N,a[i])==1){//a[i]は印を塚た人か否か1
N[b[i]]=1;
cout<<i<<endl;
}
}
for(int i=0;i<m;i++){
if(N[i]==1)count++;
}
cout<<count<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:16: error: lvalue required as left operand of assignment
26 | if(n==0&&m=0)break;
| ~~~~^~~
a.cc:53:2: error: expected '}' at end of input
53 | }
| ^
a.cc:19:11: note: to match this '{'
19 | int main(){
| ^
|
s868779645 | p00468 | C++ | #include<iostream>
using namespace std;
int n,m;
int tTot(int* N,int b){//印をつけた人
int c;
for(int i=0;i<m;i++){
if(N[i]==1){
if(i==b)c=1;
}
}
if(c==1)return 1;
else return 0;
}
int main(){
int N[500]={0};//招待された生徒に印をつける
int a[1000],b[1000];//リストの情報
int count=0;
while(true){
cin>>n>>m;//nが1から始めるので、1ひいて0から始める。
if(n==0&&m=0)break;
for(int i=0;i<m;i++){
int ak,bk;
cin>>ak>>bk;
a[i]=ak-1;b[i]=bk-1;
}
for(int i=0;i<m;i++){
if(a[i]==0){//aが番0だったら
N[b[i]]=1;//bに印をつける
}
}
//上まではOK
for(int i=0;i<m;i++){
if(tTot(N,a[i])==1){//a[i]は印を塚た人か否か1
N[b[i]]=1;
cout<<i<<endl;
}
}
for(int i=0;i<m;i++){
if(N[i]==1)count++;
}
cout<<count<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:16: error: lvalue required as left operand of assignment
26 | if(n==0&&m=0)break;
| ~~~~^~~
|
s538894744 | p00468 | C++ | #include<iostream>
using namespace std;
int tTot(int* N,int b,int m;){//印をつけた人
int c;
for(int i=0;i<m;i++){
if(N[i]==1){
if(i==b)c=1;
}
}
if(c==1)return 1;
else return 0;
}
int main(){
int n,m;
int N[500]={0};//招待された生徒に印をつける
int a[1000],b[1000];//リストの情報
int count=0;
while(true){
cin>>n>>m;//nが1から始めるので、1ひいて0から始める。
if(n==0&&m==0)break;
for(int i=0;i<m;i++){
int ak,bk;
cin>>ak>>bk;
a[i]=ak-1;b[i]=bk-1;
}
for(int i=0;i<m;i++){
if(a[i]==0){//aが番0だったら
N[b[i]]=1;//bに印をつける
}
}
//上まではOK
for(int i=0;i<m;i++){
if(tTot(N,a[i],m)==1){//a[i]は印を塚た人か否か1
N[b[i]]=1;
cout<<i<<endl;
}
}
for(int i=0;i<m;i++){
if(N[i]==1)count++;
}
cout<<count<<endl;
}
return 0;
} | a.cc:5:28: error: expected ')' before ';' token
5 | int tTot(int* N,int b,int m;){//印をつけた人
| ~ ^
| )
a.cc:5:29: error: expected unqualified-id before ')' token
5 | int tTot(int* N,int b,int m;){//印をつけた人
| ^
|
s734243882 | p00468 | C++ | int count=0; | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s167270346 | p00468 | C++ | #include <cstdio>
#include <iostream>
#include <queue>
using namespace std;
int main()
{
int n, m;
while(cin >> n && cin >> m && n && m) {
int fl[500], flfl[500][500], cnt = 0; queue<int> que;
memset(fl, 0, sizeof(fl));
memset(flfl, 0, sizeof(flfl));
for(int i=0;i < m;++i) {
int a, b;
scanf("%d\n%d", &a, &b);
if (a == 1) fl[b-1] = 1;
else if (b == 1) fl[a-1] = 1;
else flfl[a-1][b-1] = 1, flfl[b-1][a-1] = 1;
}
int flag = 1;
for(int i=0;i < n;++i) {
if (fl[i]) {
flfl[i][0] = 0;
que.push(i);
flag = 0;
++cnt;
}
}
if (flag) {
printf("%d\n", cnt);
} else {
while(que.size()) {
int i = que.front();
for(int j=0;j < n;++j) {
if (flfl[i][j] && fl[j] != 1) {
flfl[i][j] = 0;
flfl[j][i] = 0;
++cnt;
}
}
que.pop();
}
printf("%d\n", cnt);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
12 | memset(fl, 0, sizeof(fl));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <queue>
+++ |+#include <cstring>
4 | using namespace std;
|
s434413429 | p00468 | C++ | #include <iostream>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
multiset<int> s, sb;
int mem,count = 0,table[500][500],n;
multiset<int>::iterator spos;
memset(table, 0, sizeof(table));
while (cin >> mem >> n)
{
if (mem == 0 && n == 0)break;
for (int i = 0; i < n; i++){
int a, b;
cin >> a >> b;
table[a][b] = 1;
table[b][a] = 1;
}
for (int i = 1; i <= mem; i++){
if (table[1][i] == 1)
s.insert(i);
}
for (int i = 1; i <= mem; i++){
spos = s.find(i);
if (spos != s.end()){
for (int a = 1; a <= mem; a++){
if (table[i][a] == 1)
sb.insert(a);
}
}
}
for (spos = s.begin(); spos != s.end(); ++spos)
sb.insert(*spos);
for (int i = 2; i <= mem; i++) {
spos = sb.find(i);
if (spos != sb.end())
count++;
}
cout << count << endl;
}
} | a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
10 | memset(table, 0, sizeof(table));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <set>
+++ |+#include <cstring>
4 | using namespace std;
|
s528388302 | p00468 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(){
for(int b = 0;;b++){
int stun,listn;
int a = 0;
cin >> stun >> listn;
if(stun == 0 && listn == 0)break;
vector<int> fl1(listn);
vector<int> fl2(listn);
vector<int> fre1(0),fre2(0);
for(int n = 0;n<listn;n++){
cin >> fl1[n] >> fl2[n];
if(fl1[n] == 1){
fre1.push_back(fl2[n]);
a = 1;
}else if(fl2[n] == 1){
fre1.push_back(fl1[n]);
a = 1;
}
}
sort(fre1.begin(),fre1.end(),greater<int>());
for(int n = 0;n<fre1.size();n++){
for(int g = 0;g<listn;g++){
if(fre1[n] == fl1[g]){
fre2.push_back(fl2[g]);
}else if(fre1[n] == fl2[g]){
fre2.push_back(fl1[g]);
}
}
}
if(a != 0){
fre2.insert(fre2.end(),fre1.begin(),fre1.end());
sort(fre2.begin(), fre2.end());
fre2.erase(unique(fre2.begin(), fre2.end()), fre2.end());
cout << fre2.size() - 1 << endl;
}else{
cout << 0 << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
24 | sort(fre1.begin(),fre1.end(),greater<int>());
| ^~~~
| short
a.cc:37:18: error: 'unique' was not declared in this scope
37 | fre2.erase(unique(fre2.begin(), fre2.end()), fre2.end());
| ^~~~~~
|
s804978880 | p00468 | C++ | #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int tomo[1000]={0,1,0,0,0,0,0,0,0};
int lis[502][502]={0};
int N,M;
cin>>N>>M;
for(int i=0;i<M;i++){
int a,b;
cin>>a>>b;
lis[a][b]=1,lis[b][a]=1;
}
for(int i=1;i<=N;i++){
if(tomo[i]==1){
for(int j=1;j<=N;j++)
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:19:9: error: expected primary-expression before '}' token
19 | }
| ^
|
s111785105 | p00468 | C++ | class unionfind{
public:
class node{
public:
int o,r,n;
};
node* d;
void init(int n){
d = new node[n];
for(int i = 0; i < n; i++){
d[i].o = i;
d[i].r = 0;
d[i].n = 1;
}
}
void find(int n){
if(d[n].o == n){
return n;
}
return d[n].o = find(d[n].o);
}
void union(int a,int b){
a = find(a);
b = find(b);
if(a != b){
if(d[a].r > d[b].r){
d[a].n += d[b].n;
d[b].o = a;
}
else if(d[a].r == d[b].r){
d[a].r++;
d[a].n += d[b].n;
d[b].o = a;
}
else{
d[b].n += d[a].n;
d[a].o = b;
}
}
}
int num(int a){
return d[find(a)].n;
}
};
int main(){
int n,m;
scanf("%d%d",&n,&m);
unionfind uf;
uf.init(n);
for(int i = 0; i < m; i++){
int a,b;
scanf("%d%d",&a,&b);
uf.unit(a - 1,b - 1);
}
printf("%d\n",uf.num(0));
} | a.cc:22:11: error: expected identifier before '(' token
22 | void union(int a,int b){
| ^
a.cc:22:12: error: expected unqualified-id before 'int'
22 | void union(int a,int b){
| ^~~
a.cc:22:12: error: expected ')' before 'int'
22 | void union(int a,int b){
| ~^~~
| )
a.cc: In member function 'void unionfind::find(int)':
a.cc:18:8: error: return-statement with a value, in function returning 'void' [-fpermissive]
18 | return n;
| ^
a.cc:20:21: error: void value not ignored as it ought to be
20 | return d[n].o = find(d[n].o);
| ~~~~^~~~~~~~
a.cc: In member function 'int unionfind::num(int)':
a.cc:42:9: error: invalid types 'unionfind::node*[void]' for array subscript
42 | return d[find(a)].n;
| ^
a.cc: In function 'int main()':
a.cc:48:1: error: 'scanf' was not declared in this scope
48 | scanf("%d%d",&n,&m);
| ^~~~~
a.cc:54:4: error: 'class unionfind' has no member named 'unit'; did you mean 'init'?
54 | uf.unit(a - 1,b - 1);
| ^~~~
| init
a.cc:56:1: error: 'printf' was not declared in this scope
56 | printf("%d\n",uf.num(0));
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | class unionfind{
|
s032037251 | p00468 | C++ | #include <stdio.h>
class unionfind{
public:
class node{
public:
int o,r,n;
};
node* d;
void init(int n){
d = new node[n];
for(int i = 0; i < n; i++){
d[i].o = i;
d[i].r = 0;
d[i].n = 1;
}
}
int find(int n){
if(d[n].o == n){
return n;
}
return d[n].o = find(d[n].o);
}
void union(int a,int b){
a = find(a);
b = find(b);
if(a != b){
if(d[a].r > d[b].r){
d[a].n += d[b].n;
d[b].o = a;
}
else if(d[a].r == d[b].r){
d[a].r++;
d[a].n += d[b].n;
d[b].o = a;
}
else{
d[b].n += d[a].n;
d[a].o = b;
}
}
}
int num(int a){
return d[find(a)].n;
}
};
int main(){
while(1){
int n,m;
scanf("%d",&n);
if(n == 0){
return 0;
}
scanf("%d",&m);
unionfind uf;
uf.init(n);
for(int i = 0; i < m; i++){
int a,b;
scanf("%d%d",&a,&b);
uf.unit(a - 1,b - 1);
}
printf("%d\n",uf.num(0));
}
} | a.cc:24:11: error: expected identifier before '(' token
24 | void union(int a,int b){
| ^
a.cc:24:12: error: expected unqualified-id before 'int'
24 | void union(int a,int b){
| ^~~
a.cc:24:12: error: expected ')' before 'int'
24 | void union(int a,int b){
| ~^~~
| )
a.cc: In function 'int main()':
a.cc:61:4: error: 'class unionfind' has no member named 'unit'; did you mean 'init'?
61 | uf.unit(a - 1,b - 1);
| ^~~~
| init
|
s062908390 | p00468 | C++ | #include <stdio.h>
#include <vector>
using namespace std;
vector<int> sei[100000];
bool s1[100000];
bool s2[100000];
int main(){
while(1){
int n,m;
scanf("%d%d",&n,&m);
if(n == 0){
return 0;
}
for(int i = 0; i < m; i++){
int a,b;
scanf("%d%d",&a,&b);
a--;
b--;
sei[a].push_back(b);
sei[b].pus_back(a);
}
for(int i = 0; i < n; i++){
s1[i] = false;
s2[i] = false;
}
for(auto i : sei[0]){
s1[i] = true;
}
for(int i = 0; i < n; i++){
if(s1[i]){
for(auto j : sei[i]){
s2[j] = true;
}
}
}
int all = 0;
for(int i = 0; i < n; i++){
if(s1[i] || s2[i]){
all++;
}
}
printf("%d\n",all - 1);
}
} | a.cc: In function 'int main()':
a.cc:24:8: error: 'class std::vector<int>' has no member named 'pus_back'; did you mean 'push_back'?
24 | sei[b].pus_back(a);
| ^~~~~~~~
| push_back
|
s624976521 | p00468 | C++ | #include <stdio.h>
#include <vector>
using namespace std;
vector<int> sei[100000];
bool s1[100000];
bool s2[100000];
int main(){
while(1){
int n,m;
scanf("%d%d",&n,&m);
if(n == 0){
return 0;
}
for(int i = 0; i < m; i++){
int a,b;
scanf("%d%d",&a,&b);
a--;
b--;
sei[a].push_back(b);
sei[b].pus_back(a);
}
for(int i = 0; i < n; i++){
s1[i] = false;
s2[i] = false;
}
for(auto i : sei[0]){
s1[i] = true;
}
for(int i = 0; i < n; i++){
if(s1[i]){
for(auto j : sei[i]){
s2[j] = true;
}
}
}
int all = 0;
for(int i = 0; i < n; i++){
if(s1[i] || s2[i]){
all++;
}
}
printf("%d\n",all - 1);
}
} | a.cc: In function 'int main()':
a.cc:24:8: error: 'class std::vector<int>' has no member named 'pus_back'; did you mean 'push_back'?
24 | sei[b].pus_back(a);
| ^~~~~~~~
| push_back
|
s907083410 | p00468 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m, n){
vector<int> g(n);
for(int i=0;i<n;i++){
int a,b;
cin >> a >> b;
a--; b--;
g[a].push_back(b);
g[b].push_back(a);
}
set<int> invite;
for(int v : g[0]){
invite.insert(v);
for(int u : g[v]){
invite.insert(u);
}
}
cout << invite.size() << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:12: error: request for member 'push_back' in 'g.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
12 | g[a].push_back(b);
| ^~~~~~~~~
a.cc:13:12: error: request for member 'push_back' in 'g.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
13 | g[b].push_back(a);
| ^~~~~~~~~
a.cc:17:20: error: 'begin' was not declared in this scope
17 | for(int v : g[0]){
| ^
a.cc:17:20: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note: 'std::begin'
1238 | begin(const valarray<_Tp>& __va) noexcept
| ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note: 'std::filesystem::__cxx11::begin'
608 | begin(recursive_directory_iterator __iter) noexcept
| ^~~~~
a.cc:17:20: error: 'end' was not declared in this scope
17 | for(int v : g[0]){
| ^
a.cc:17:20: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note: 'std::end'
1265 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note: 'std::filesystem::__cxx11::end'
613 | end(recursive_directory_iterator) noexcept
| ^~~
a.cc:19:22: error: 'begin' was not declared in this scope
19 | for(int u : g[v]){
| ^
a.cc:19:22: note: suggested alternatives:
/usr/include/c++/14/valarray:1238:5: note: 'std::begin'
1238 | begin(const valarray<_Tp>& __va) noexcept
| ^~~~~
/usr/include/c++/14/bits/fs_dir.h:608:3: note: 'std::filesystem::__cxx11::begin'
608 | begin(recursive_directory_iterator __iter) noexcept
| ^~~~~
a.cc:19:22: error: 'end' was not declared in this scope
19 | for(int u : g[v]){
| ^
a.cc:19:22: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note: 'std::end'
1265 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note: 'std::filesystem::__cxx11::end'
613 | end(recursive_directory_iterator) noexcept
| ^~~
|
s201030818 | p00468 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m, n){
vecto< vector<int> > g(n);
for(int i=0;i<n;i++){
int a,b;
cin >> a >> b;
a--; b--;
g[a].push_back(b);
g[b].push_back(a);
}
set<int> invite;
for(int v : g[0]){
invite.insert(v);
for(int u : g[v]){
invite.insert(u);
}
}
cout << invite.size() << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:5: error: 'vecto' was not declared in this scope
7 | vecto< vector<int> > g(n);
| ^~~~~
a.cc:7:24: error: expected primary-expression before '>' token
7 | vecto< vector<int> > g(n);
| ^
a.cc:7:26: error: 'g' was not declared in this scope
7 | vecto< vector<int> > g(n);
| ^
|
s850560096 | p00468 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin >> n >> m, n){
vecto< vector<int> > g(n);
for(int i=0;i<m;i++){
int a,b;
cin >> a >> b;
a--; b--;
g[a].push_back(b);
g[b].push_back(a);
}
set<int> invite;
for(int v : g[0]){
invite.insert(v);
for(int u : g[v]){
invite.insert(u);
}
}
cout << invite.size() << endl;
}
} | a.cc: In function 'int main()':
a.cc:7:5: error: 'vecto' was not declared in this scope
7 | vecto< vector<int> > g(n);
| ^~~~~
a.cc:7:24: error: expected primary-expression before '>' token
7 | vecto< vector<int> > g(n);
| ^
a.cc:7:26: error: 'g' was not declared in this scope
7 | vecto< vector<int> > g(n);
| ^
|
s343179610 | p00468 | C++ | ll | a.cc:1:1: error: 'll' does not name a type
1 | ll
| ^~
|
s753564242 | p00468 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int ni,m,f1,f2,ans=0,ans2=0;
int f[1000][1000],fr[510];
while(1){
cin >> ni >> m;
fill(f[0],f[ni+1]+ni+1,0);
fill(m,m+ni+1,0);
if(ni==0&&m==0)break;
for(int i=0;i<m;i++){
cin >> f1 >> f2;
if(f1>f2){
int z=f1;
f1=f2;
f2=z;
}
f[f1][f2]==1;
}
//for(int j=1;j<=ni;j++){
for(int u=1;u<=ni;u++){
if(f[1][u]==1){
//if(j==1){
if(fr[f2]==0){
ans=ans+1;
fr[f2]=1;
}
for(int y=2;y<=ni;y++){
if(f[u][y]==1&&fr[y]==0){
ans=ans+1;
fr[y]=1;
}
}
//}
}
//}
}
cout << ans << endl;
ans=0;
}
return 0;
} | In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = int; _Tp = int]'
998 | { std::__fill_a1(__first, __last, __value); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = int; _Tp = int]'
1029 | std::__fill_a(__first, __last, __value);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:9: required from here
10 | fill(m,m+ni+1,0);
| ~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:9: error: invalid type argument of unary '*' (have 'int')
952 | *__first = __tmp;
| ^~~~~~~~
|
s547118856 | p00468 | C++ | import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
public class Main{
static PrintWriter out;
static InputReader ir;
static void solve(){
for(;;){
int n=ir.nextInt();
int m=ir.nextInt();
if(n==0) return;
G g=new G(n,true);
for(int i=0;i<n;i++) g.addEdge(ir.nextInt()-1,ir.nextInt()-1,1);
int[] d=g.dijkstra(0);
int cnt=0;
for(int i=1;i<n;i++) if(d[i]<=2) cnt++;
out.println(cnt);
}
}
static class G{
AL[] g;
private int V;
private boolean ndir;
public G(int V,boolean ndir){
this.V=V;
this.ndir=ndir;
g=new AL[V];
for(int i=0;i<V;i++){
g[i]=new AL();
}
}
public void addEdge(int u,int v,int t){
g[u].add(new int[]{v,t});
if(this.ndir) g[v].add(new int[]{u,t});
}
public void addEdge(int u,int v){
addEdge(u,v,0);
}
public int[] dijkstra(int s){
int[] dist=new int[this.V];
java.util.PriorityQueue<int[]> pque=new java.util.PriorityQueue<int[]>(11,new Comparator<int[]>(){
public int compare(int[] a,int[] b){
return Integer.compare(a[0],b[0]);
}
});
Arrays.fill(dist,1<<26);
dist[s]=0;
pque.offer(new int[]{0,s});
while(!pque.isEmpty()){
int[] p=pque.poll();
int v=p[1];
if(dist[v]<p[0]) continue;
for(int i=0;i<g[v].size();i++){
int to=g[v].get(i)[0],cost=g[v].get(i)[1];
if(dist[to]>dist[v]+cost){
dist[to]=dist[v]+cost;
pque.offer(new int[]{dist[to],to});
}
}
}
return dist;
}
public int[] buildTPO(){
boolean[] vis=new boolean[this.V];
ArrayList<Integer> ord=new ArrayList<>();
for(int i=0;i<this.V;i++) if(!vis[i]) ts(i,vis,ord);
int[] ret=new int[V];
for(int i=ord.size()-1;i>=0;i--) ret[ord.size()-1-i]=ord.get(i);
return ret;
}
private void ts(int now,boolean[] vis,ArrayList<Integer> ord){
vis[now]=true;
int to;
for(int i=0;i<g[now].size();i++){
to=g[now].get(i)[0];
if(!vis[to]) ts(to,vis,ord);
}
ord.add(now);
}
static class AL extends ArrayList<int[]>{};
}
public static void main(String[] args) throws Exception{
ir=new InputReader(System.in);
out=new PrintWriter(System.out);
solve();
out.flush();
}
static class InputReader {
private InputStream in;
private byte[] buffer=new byte[1024];
private int curbuf;
private int lenbuf;
public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
public boolean hasNextByte() {
if(curbuf>=lenbuf){
curbuf= 0;
try{
lenbuf=in.read(buffer);
}catch(IOException e) {
throw new InputMismatchException();
}
if(lenbuf<=0) return false;
}
return true;
}
private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
public boolean hasNext(){skip(); return hasNextByte();}
public String next(){
if(!hasNext()) throw new NoSuchElementException();
StringBuilder sb=new StringBuilder();
int b=readByte();
while(!isSpaceChar(b)){
sb.appendCodePoint(b);
b=readByte();
}
return sb.toString();
}
public int nextInt() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
int res=0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public long nextLong() {
if(!hasNext()) throw new NoSuchElementException();
int c=readByte();
while (isSpaceChar(c)) c=readByte();
boolean minus=false;
if (c=='-') {
minus=true;
c=readByte();
}
long res = 0;
do{
if(c<'0'||c>'9') throw new InputMismatchException();
res=res*10+c-'0';
c=readByte();
}while(!isSpaceChar(c));
return (minus)?-res:res;
}
public double nextDouble(){return Double.parseDouble(next());}
public BigInteger nextBigInteger(){return new BigInteger(next());}
public int[] nextIntArray(int n){
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=nextInt();
return a;
}
public long[] nextLongArray(int n){
long[] a=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
public char[][] nextCharMap(int n,int m){
char[][] map=new char[n][m];
for(int i=0;i<n;i++) map[i]=next().toCharArray();
return map;
}
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.InputStream;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.PrintWriter;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.util.ArrayList;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.Arrays;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.util.Comparator;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.InputMismatchException;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.util.NoSuchElementException;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import java.math.BigInteger;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: expected unqualified-id before 'public'
11 | public class Main{
| ^~~~~~
|
s223219175 | p00468 | C++ | #include "bits/stdc++.h"
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define sz(obj) ((int)(obj).size())
int main()
{
int n, m;
while (cin >> n >> m, n + m){
int a, b, ff[n] = {0}, cnt = 0;
bool friends[n][n];
REP(i, n){
REP(j, n) friends[i][j] = 0;
}
REP(i, m){
cin >> a >> b;
friends[min(a, b) - 1][max(a, b) - 1]++;
}
REP(i, n){
if (friends[0][i]){
ff[cnt++] = i;
}
}
int tmp = cnt;
REP(i, tmp){
REP(j, n){
if (friends[ff[i]][j] && count(ff, ff + cnt, j) == 0){
ff[cnt++] = j;
}
}
}
cout << cnt << endl;
}
} | a.cc: In function 'int main()':
a.cc:20:43: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
20 | friends[min(a, b) - 1][max(a, b) - 1]++;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
s222920142 | p00468 | C++ | #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;
#define N 505
#define INF 999999
int M[N][N];
int dis[N]; //????????¨????????¢
void bfs(int n){
queue<int> q; //?¨??????????????????\??????
q.push(1);
rep(i,N) dis[i] = INF;
dis[1] = 0;
int u;
while(!q.empty()){
u = q.front(); q.pop();
rep(i,n){
if(M[u][i] == 0 || dis[i] != INF) continue;
dis[i] = dis[u] + 1; //??°???????????±???
q.push(i);
}
}
}
int main(){
int n, m;
while(cin >> n >> m, n||m){
rep(i,N) rep(j,N) M[i][j] = 0;
rep(i,m){
int a, b;
cin >> a >> b;
M[a][b] = 1;
}
bfs(1, n);
int ans = 0;
rep(i,n) if(dis[i] == 1 || dis[i] == 2) ans++;
cout << ans << endl;
}
} | a.cc: In function 'int main()':
a.cc:42:12: error: too many arguments to function 'void bfs(int)'
42 | bfs(1, n);
| ~~~^~~~~~
a.cc:15:6: note: declared here
15 | void bfs(int n){
| ^~~
|
s220773954 | p00468 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> v[500];
int n,m;
int p[500];
void solve(int num){
for(int i = 0;i<v[num].size();i++){
p[v[num][i]] = 1;
// cout<<v[num][i]<<endl;
}
}
int main(){
while(cin>>n,cin>>m){
if(n==0&&m==0)
break;
for(int i = 0;i<m;i++){
int a,b;
cin>>a>>b;
a--;b--;
v[a].push_back(b);
v[b].push_back(a);
}
memset(p,0,sizeof(p));
for(int i= 0;i<v[0].size();i++){
solve(v[0][i]);
}
int ans = 0;
for(int i = 1;i<n;i++){
if(p[i] == 1)
ans++;
}
cout<<ans<<endl;
for(int i = 0;i<500;i++)
v[i].clear();
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:5: error: 'memset' was not declared in this scope
33 | memset(p,0,sizeof(p));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<vector>
+++ |+#include <cstring>
4 |
|
s858158787 | p00468 | C++ | #include<stdio.h>
int a[10000],b[10000];
int main(void)
{
int n,k,i,,c,x[501];
while(1){
c=0;
scanf("%d",&n);
scanf("%d",&k);
if(n==0&&k==0){
break;
}
for(i=0;i<=n;i++){
a[i]=0;
b[i]=0;
x[i]=0;
}
x[1]=1;
for(i=0;i<k;i++){
scanf("%d %d",&a[i],&b[i]);
if(a[i]==1){
x[b[i]]=1;
c++;
}
}
for(i=0;i<k;i++){
if(x[a[i]]==1&&x[b[i]]==0){
x[b[i]]=3;
c++;
}
if(x[b[i]]==1&&x[a[i]]==0){
x[a[i]]=3;
c++;
}
}
printf("%d\n",c);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:5:11: error: expected unqualified-id before ',' token
5 | int n,k,i,,c,x[501];
| ^
|
s565792438 | p00468 | C++ | #include <stdio.h>
#include <string>
int n, m, a[11234], b[11234];
int my_friends[11234], their_friends[11234];
int tmp = 0, ans = 0;
bool cancel = false;
int main(void) {
scanf("%d%d", &n, &m);
for (int i = 0; i < m; ++i) { scanf("%d%d", &a[i], &b[i]); }
memset(my_friends, -1, sizeof(my_friends));
memset(their_friends, -1, sizeof(their_friends));
for (int i = 0; i < m; ++i) {
if (a[i] == 1) { my_friends[b[i] - 1] = b[i]; tmp++; }
}
ans = tmp;
for (int i = 0; i < m; ++i) {
for (int j = 0; j <= tmp; ++j) {
if (a[i] == my_friends[j]) {
for (int k = 0; k < n; ++k) {
if (b[i] == my_friends[k] || b[i] == their_friends[k]) {
cancel = true;
break;
}
}
if (cancel == false) { their_friends[b[i] - 1] = b[i]; ans++; }
cancel = false;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
13 | memset(my_friends, -1, sizeof(my_friends));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <string>
+++ |+#include <cstring>
3 |
|
s688899322 | p00468 | C++ | #include <stdio.h>
#include <string>
int n, m, a[11234], b[11234];
int my_friends[11234], their_friends[11234];
int tmp = 0, ans = 0;
bool cancel = false;
int main(void) {
scanf("%d%d", &n, &m);
for (int i = 0; i < m; ++i) { scanf("%d%d", &a[i], &b[i]); }
memset(my_friends, -1, sizeof(my_friends));
memset(their_friends, -1, sizeof(their_friends));
for (int i = 0; i < m; ++i) {
if (a[i] == 1) { my_friends[b[i] - 1] = b[i]; tmp++; }
}
ans = tmp;
for (int i = 0; i < m; ++i) {
for (int j = 0; j <= tmp; ++j) {
if (a[i] == my_friends[j]) {
for (int k = 0; k < n; ++k) {
if (b[i] == my_friends[k] || b[i] == their_friends[k]) {
cancel = true;
break;
}
}
if (cancel == false) { their_friends[b[i] - 1] = b[i]; ans++; }
cancel = false;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
13 | memset(my_friends, -1, sizeof(my_friends));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <string>
+++ |+#include <cstring>
3 |
|
s651452026 | p00468 | C++ | #include <stdio.h>
#include <string>
int n, m, a[11234], b[11234];
int my_friends[11234], their_friends[11234];
int tmp = 0, ans = 0;
bool cancel = false;
int main(void) {
scanf("%d%d", &n, &m);
for (int i = 0; i < m; ++i) { scanf("%d%d", &a[i], &b[i]); }
memset(my_friends, -1, sizeof(my_friends));
memset(their_friends, -1, sizeof(their_friends));
for (int i = 0; i < m; ++i) {
if (a[i] == 1) { my_friends[b[i] - 1] = b[i]; tmp++; }
}
ans = tmp;
for (int i = 0; i < m; ++i) {
for (int j = 0; j <= tmp; ++j) {
if (a[i] == my_friends[j]) {
for (int k = 0; k < n; ++k) {
if (b[i] == my_friends[k] || b[i] == their_friends[k]) {
cancel = true;
break;
}
}
if (cancel == false) { their_friends[b[i] - 1] = b[i]; ans++; }
cancel = false;
}
}
}
printf("%d\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
13 | memset(my_friends, -1, sizeof(my_friends));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <string>
+++ |+#include <cstring>
3 |
|
s792288554 | p00468 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m){
if (n == 0 && m == 0)return 0;
vector<pair<int, int>>l;
vector<int>k;
vector<int>linst;
cin >> n >> m;
for (int i = 0; i < m; i++) {
pair<int, int>p;
cin >> p.first >> p.second;
if (p.first == 1) {
k.push_back(p.second);
linst.push_back(p.second);
}
else if (p.second == 1) {
k.push_back(p.first);
linst.push_back(p.first);
}
else l.push_back(p);
}
for (int i = 0; i < l.size(); i++) {
if (find(k.begin(), k.end(), l[i].first) != k.end()) {
if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
linst.push_back(l[i].second);
}
}
if (find(k.begin(), k.end(), l[i].second) != k.end()) {
if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
linst.push_back(l[i].first);
}
}
}
cout << linst.size() << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
26 | if (find(k.begin(), k.end(), l[i].first) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:26:33: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
26 | if (find(k.begin(), k.end(), l[i].first) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
27 | if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:27:41: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
27 | if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
31 | if (find(k.begin(), k.end(), l[i].second) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:31:33: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
31 | if (find(k.begin(), k.end(), l[i].second) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:32:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
32 | if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:32:41: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
32 | if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s034471797 | p00468 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m){
if (n == 0 && m == 0)return 0;
vector<pair<int, int>>l;
vector<int>k;
vector<int>linst;
cin >> n >> m;
for (int i = 0; i < m; i++) {
pair<int, int>p;
cin >> p.first >> p.second;
if (p.first == 1) {
k.push_back(p.second);
linst.push_back(p.second);
}
else if (p.second == 1) {
k.push_back(p.first);
linst.push_back(p.first);
}
else l.push_back(p);
}
for (int i = 0; i < l.size(); i++) {
if (find(k.begin(), k.end(), l[i].first) != k.end()) {
if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
linst.push_back(l[i].second);
}
}
if (find(k.begin(), k.end(), l[i].second) != k.end()) {
if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
linst.push_back(l[i].first);
}
}
}
cout << linst.size() << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
26 | if (find(k.begin(), k.end(), l[i].first) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:26:33: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
26 | if (find(k.begin(), k.end(), l[i].first) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
27 | if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:27:41: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
27 | if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
31 | if (find(k.begin(), k.end(), l[i].second) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:31:33: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
31 | if (find(k.begin(), k.end(), l[i].second) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:32:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
32 | if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:32:41: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
32 | if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s266833627 | p00468 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main() {
int n, m;
while (cin >> n >> m){
if (n == 0 && m == 0)return 0;
vector<pair<int, int>>l;
vector<int>k;
vector<int>linst;
cin >> n >> m;
for (int i = 0; i < m; i++) {
pair<int, int>p;
cin >> p.first >> p.second;
if (p.first == 1) {
k.push_back(p.second);
linst.push_back(p.second);
}
else if (p.second == 1) {
k.push_back(p.first);
linst.push_back(p.first);
}
else l.push_back(p);
}
for (int i = 0; i < l.size(); i++) {
if (find(k.begin(), k.end(), l[i].first) != k.end()) {
if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
linst.push_back(l[i].second);
}
}
if (find(k.begin(), k.end(), l[i].second) != k.end()) {
if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
linst.push_back(l[i].first);
}
}
}
cout << linst.size() << endl;
}
} | a.cc: In function 'int main()':
a.cc:26:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
26 | if (find(k.begin(), k.end(), l[i].first) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:26:33: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
26 | if (find(k.begin(), k.end(), l[i].first) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:27:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
27 | if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:27:41: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
27 | if (find(linst.begin(), linst.end(), l[i].second) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:33: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
31 | if (find(k.begin(), k.end(), l[i].second) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:31:33: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
31 | if (find(k.begin(), k.end(), l[i].second) != k.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:32:41: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
32 | if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:32:41: note: '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
32 | if (find(linst.begin(), linst.end(), l[i].first) == linst.end()) {
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s295456808 | p00468 | C++ |
#include <stdio.h>
int main(){
int mf=0,mff=0,n,list,a[500],b[500],j,x=0,z[500],total,k,g[1000],y=0,q,m,kool[500];
while(1){
mf=0; mff=0;
scanf("%d",&n);
scanf("%d",&list);
if(n==0&&list==0){break;}
for(j=0;j<list;j++){
scanf("%d %d",&a[j],&b[j]);
if(a[j]==1){
z[x]=b[j]; x++; mf++;kool[j]=1;
}else if(b[j]==1){
z[x]=a[j]; x++; mf++;kool[j]=1;
}
}
for(j=0;j<list;j++){
for(m=0;m<x;m++){
if(a[j]!=1&&b[j]==z[m]&&kool!=1){
mff++;
}
else if(b[j]!=1&&a[j]==z[m]&&kool!=1){
mff++;
}
}
total=mf+mff;
g[y]=mff;
y++;
}
printf("%d\n",mff);
}
} | a.cc: In function 'int main()':
a.cc:22:45: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
22 | if(a[j]!=1&&b[j]==z[m]&&kool!=1){
| ~~~~^~~
a.cc:25:50: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
25 | else if(b[j]!=1&&a[j]==z[m]&&kool!=1){
| ~~~~^~~
|
s955428537 | p00468 | C++ | #include <bits/stdc++.h>
using namespace std;
bool mem[500][500];
bool lis[500];
int n,m,kazu;
int main(){
while(1){
kazu=0;
fill(lis,lis+500,0);
for(int i=0;i<500;i++){
fill(mem,mem+500,0);
}
cin>>n;
cin>>m;
if(n+m==0)break;
int a,b;
for(int i=0;i<m;i++){
cin>>a>>b;
mem[a-1][b-1]=1;mem[b-1][a-1]=1;
}
for(int i=0;i<n;i++){
if(mem[0][i]==1){
lis[i]=1;
for(int j=0;j<n;j++){ if(mem[i][j]==1){ lis[j]=1; } }
}
}
lis[0]=0;
for(int i=0;i<n;i++){ if(lis[i]==1){kazu++;} }
cout<<kazu<<endl;
}
} | In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool (*)[500]; _Tp = int; typename __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/14/bits/stl_algobase.h:998:21: required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = bool (*)[500]; _Tp = int]'
998 | { std::__fill_a1(__first, __last, __value); }
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1029:20: required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = bool (*)[500]; _Tp = int]'
1029 | std::__fill_a(__first, __last, __value);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:17: required from here
11 | fill(mem,mem+500,0);
| ~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:952:18: error: incompatible types in assignment of 'const int' to 'bool [500]'
952 | *__first = __tmp;
| ~~~~~~~~~^~~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.