submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s366191943
|
p00011
|
C
|
#include<stdio.h>
int main(){
int w, n, a, b, i, store, s[30];
for(i = 0; i < 30; i++) s[i] = i + 1;
scanf("%d", &w);
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d,%d" &a, &b);
store = s[a - 1];
s[a - 1] = s[b - 1];
s[b - 1] = store;
}
for(i = 0; i < w; i++) printf("%d\n", s[i]);
return 0;
}
|
main.c: In function 'main':
main.c:9:31: error: invalid operands to binary & (have 'char *' and 'int')
9 | scanf("%d,%d" &a, &b);
| ~~~~~~~ ^
| |
| char *
|
s631795526
|
p00011
|
C
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int w,n,h,i;
scanf("%d\n",&w);
scanf("%d\n",&n);
int a[],b[];
int c[];
for(i=0;n>i;++1){
scanf("%d,%d\n",&a[i],&b[i]);
}
for(i=1;w>=i;++i){
i=c[i];
}
for(i=0;n>i;++i){
h=c[b[i]];
c[b[i]]=c[a[i]];
c[a[i]]=h;
}
for(i=0;w>i;++i){
printf("%d",c[i]);
}
return 0;
}
|
main.c: In function 'main':
main.c:11:7: error: array size missing in 'a'
11 | int a[],b[];
| ^
main.c:11:11: error: array size missing in 'b'
11 | int a[],b[];
| ^
main.c:12:7: error: array size missing in 'c'
12 | int c[];
| ^
main.c:14:15: error: lvalue required as increment operand
14 | for(i=0;n>i;++1){
| ^~
|
s493433888
|
p00011
|
C
|
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int w,n;
cin>>w>>n;
vector<int>a(w);
for(int i=0;i<w;i++)a[i]=i+1;
for(int i=0;i<n;i++){
int b,c;
char d;
cin>>b>>d>>c;
swap(a[b-1],a[c-1]);
}
for(int i=0;i<w;i++)cout<<a[i]<<endl;
}
|
main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s671066916
|
p00011
|
C
|
#include<stdio.h>
int main(){
int w,n,a[31];
scanf("%d",&w);
for(i=0;i<w;i++){
a[i]=i+1;
}
scanf("%d",&n);
for(i=0,i<n;i++){
scanf("%d,%d",&c1,&c2);
t=a[c1];
a[c1]=a[c2];
a[c2]=t;
}
for(i=0;i<w;i++){
printf("%d\n",a[i];);
}
return 0;
}
|
main.c: In function 'main':
main.c:7:13: error: 'i' undeclared (first use in this function)
7 | for(i=0;i<w;i++){
| ^
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:24: error: expected ';' before ')' token
11 | for(i=0,i<n;i++){
| ^
| ;
main.c:12:32: error: 'c1' undeclared (first use in this function)
12 | scanf("%d,%d",&c1,&c2);
| ^~
main.c:12:36: error: 'c2' undeclared (first use in this function)
12 | scanf("%d,%d",&c1,&c2);
| ^~
main.c:13:17: error: 't' undeclared (first use in this function)
13 | t=a[c1];
| ^
main.c:18:35: error: expected ')' before ';' token
18 | printf("%d\n",a[i];);
| ~ ^
| )
|
s716346963
|
p00011
|
C
|
#include<stdio.h>
int main(){
int w,n,a[31];
scanf("%d",&w);
for(i=0;i<w;i++){
a[i]=i+1;
}
scanf("%d",&n);
for(i=0,i<n;i++){
scanf("%d,%d",&c1,&c2);
t=a[c1];
a[c1]=a[c2];
a[c2]=t;
}
for(i=0;i<w;i++){
printf("%d\n",a[i]);
}
return 0;
}
|
main.c: In function 'main':
main.c:7:13: error: 'i' undeclared (first use in this function)
7 | for(i=0;i<w;i++){
| ^
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:24: error: expected ';' before ')' token
11 | for(i=0,i<n;i++){
| ^
| ;
main.c:12:32: error: 'c1' undeclared (first use in this function)
12 | scanf("%d,%d",&c1,&c2);
| ^~
main.c:12:36: error: 'c2' undeclared (first use in this function)
12 | scanf("%d,%d",&c1,&c2);
| ^~
main.c:13:17: error: 't' undeclared (first use in this function)
13 | t=a[c1];
| ^
|
s576729867
|
p00011
|
C
|
#include<stdio.h>
int main(){
int w,n,a[31];
int i,c1,c2,t;
scanf("%d",&w);
for(i=0;i<w;i++){
a[i]=i+1;
}
scanf("%d",&n);
for(i=0,i<n;i++){
scanf("%d,%d",&c1,&c2);
t=a[c1];
a[c1]=a[c2];
a[c2]=t;
}
for(i=0;i<w;i++){
printf("%d\n",a[i]);
}
return 0;
}
|
main.c: In function 'main':
main.c:11:24: error: expected ';' before ')' token
11 | for(i=0,i<n;i++){
| ^
| ;
|
s155951867
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int n;
int a[1000000];
int sum[1000000];
int main(int argc, char const *argv[])
{
int tc[30];
cin>>tc[30];
int w,v;
for (int i = 0; i < 30; ++i) tc[i] = i+1;
for (int i = 0; i < v; ++i)
{
int a,b;
cin>>a>>b;
int c=tc[a-1];
tc[a-1]=tc[b-1];
tc[b-1];
}
for (int i = 0; i < a; ++i)
{
cout<<t[i]<<endl;
}
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:22:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
22 | for (int i = 0; i < a; ++i)
| ~~^~~
a.cc:24:31: error: 't' was not declared in this scope
24 | cout<<t[i]<<endl;
| ^
|
s262369391
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int n;
int a[1000000];
int sum[1000000];
int main(int argc, char const *argv[])
{
int tc[30];
cin>>tc[30];
int w,v;
for (int i = 0; i < 30; ++i) tc[i] = i+1;
for (int i = 0; i < v; ++i)
{
int a,b;
cin>>a>>b;
int c=tc[a-1];
tc[a-1]=tc[b-1];
tc[b-1];
}
for (int i = 0; i < a; ++i)
{
cout<<t[i]<<endl;
}
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:22:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
22 | for (int i = 0; i < a; ++i)
| ~~^~~
a.cc:24:31: error: 't' was not declared in this scope
24 | cout<<t[i]<<endl;
| ^
|
s927590529
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int n;
int a[1000000];
int sum[1000000];
int main(int argc, char const *argv[])
{
int tc[30];
cin>>tc[30];
int w,v;
for (int i = 0; i < 30; ++i) tc[i] = i+1;
for (int i = 0; i < v; ++i)
{
int a,b;
cin>>a>>b;
int c=tc[a-1];
tc[a-1]=tc[b-1];
tc[b-1];
}
for (int i = 0; i < strlen(a); ++i)
cout<<t[i]<<endl;
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:22:37: error: 'strlen' was not declared in this scope
22 | for (int i = 0; i < strlen(a); ++i)
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:24:31: error: 't' was not declared in this scope
24 | cout<<t[i]<<endl;
| ^
|
s650291812
|
p00011
|
C++
|
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
//Scanner reader=new Scanner(System.in);
String s=reader.readLine();
int in=Integer.parseInt(s);
//int in=reader.nextInt();
int[] out=new int[in];
for(int i=1;i<=in;i++)out[i-1]=i;
//in=reader.nextInt();
s=reader.readLine();
in=Integer.parseInt(s);
for(int i=0;i<in;i++){
String s1=reader.readLine();
String[] in1=s1.split(",");
int a=Integer.parseInt(in1[0]);
int b=Integer.parseInt(in1[1]);
int tmp=out[a-1];
out[a-1]=out[b-1];
out[b-1]=tmp;
}
for(int i=0;i<out.length;i++)System.out.println(out[i]);
}
}
|
a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
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.util.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main{
| ^~~~~~
|
s117043496
|
p00011
|
C++
|
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
//Scanner reader=new Scanner(System.in);
String s=reader.readLine();
int in=Integer.parseInt(s);
//int in=reader.nextInt();
int[] out=new int[in];
for(int i=1;i<=in;i++)out[i-1]=i;
//in=reader.nextInt();
s=reader.readLine();
in=Integer.parseInt(s);
for(int i=0;i<in;i++){
String s1=reader.readLine();
String[] in1=s1.split(",");
int a=Integer.parseInt(in1[0]);
int b=Integer.parseInt(in1[1]);
int tmp=out[a-1];
out[a-1]=out[b-1];
out[b-1]=tmp;
}
for(int i=0;i<out.length;i++)System.out.println(out[i]);
}
}
|
a.cc:1:1: error: 'import' does not name a type
1 | import java.io.*;
| ^~~~~~
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.util.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main{
| ^~~~~~
|
s558835632
|
p00011
|
C++
|
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
typedef long long int LLI;
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
int n,m;
char d;
cin>>n>>m;
vector<int>out(n);
rep(i,n)out[i]=i+1;
rep(i,m){
int a,b;
cin>>a>>d>x>b;
swap(out[a-1],out[b-1]);
}
rep(i,n)cout<<out[i]<<endl;
}
|
a.cc: In function 'int main()':
a.cc:28:15: error: 'x' was not declared in this scope
28 | cin>>a>>d>x>b;
| ^
|
s792137211
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int main()
{
int x[30];
int w, n;
cin >> w >> n;
for(int i=0; i<w; i++) x[i] = i+1;
int a, b;
for(int i=0; i<n; i++){
cin >> a >> b;
int tmp = x[a];
x[a] = x[b];
x[b] = tmp;
}
for(int i=0; i<w; i++){
cout << x[i];
if(i == w-1) break;;
cout << '\n';
}
|
a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s546131159
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int main()
{
int x[30];
int w, n;
cin >> w >> n;
for(int i=0; i<w; i++) x[i] = i+1;
int a, b;
for(int i=0; i<n; i++){
cin >> a >> b;
int tmp = x[a];
x[a] = x[b];
x[b] = tmp;
}
for(int i=0; i<w; i++){
cout << x[i];
if(i == w-1) break;
cout << '\n';
}
|
a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s262842434
|
p00011
|
C++
|
#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include <sstream>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define scanf scanf_s
int w, n;
int ban[35];
int main()
{
REP(i, 35) ban[i] = i;
cin >> w >> n;
REP(i, n)
{
int a, b;
scanf("%d,%d", &a, &b);
swap(ban[a], ban[b]);
}
FOR(i,1, w+1) cout << ban[i] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:22:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
22 | #define scanf scanf_s
| ^~~~~~~
a.cc:33:17: note: in expansion of macro 'scanf'
33 | scanf("%d,%d", &a, &b);
| ^~~~~
|
s910088318
|
p00011
|
C++
|
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)
typedef pair<int, int> P;
int dp[60];
int main()
{
int w(0),n(0);
REP(i, 60){
dp[i] = i;
}
cin >> n >> w;
REP(i, w){
int a, b;
char c;
scanf_s("%d,%d", &a,&b);
swap(dp[a], dp[b]);
}
REP(i, n){
cout << dp[i+1] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:29:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
29 | scanf_s("%d,%d", &a,&b);
| ^~~~~~~
| scanf
|
s594163047
|
p00011
|
C++
|
#include <iostream>
using namespace std;
int main(){
int verticals,horizontals,a,b;
char commma; //commaを抜くための変数
cin >> verticals;
cin >> horizontals;
int res[verticals];
for(int i=0;i<verticals;i++) res[i] = i+1;
for(int i=0;i<horizontals;i++){
cin >> a >> comma >> b;
int tmp = res[a-1];
res[a-1] = res[b-1];
res[b-1] = tmp;
}
for(int i=0;i<verticals;i++) cout << res[i] << endl;
}
|
a.cc: In function 'int main()':
a.cc:14:17: error: 'comma' was not declared in this scope; did you mean 'commma'?
14 | cin >> a >> comma >> b;
| ^~~~~
| commma
|
s299804095
|
p00011
|
C++
|
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
void getValues(string& s, int& a, int & b)
{
string::size_type p = s.find(',');
string sa = s.substr(0, p);
string sb = s.substr(p + 1);
a = atoi(sa.c_str());
b = atoi(sb.c_str());
}
int main()
{
int w, n, a, b;
cin >> w >> n;
int W[31] = {};
FOR(i, 1, w + 1) W[i] = i;
string line;
while (n--){
cin >> line;
getValues(line, a, b);
swap(W[a], W[b]);
}
FOR(i, 1, w + 1) cout << W[i] << "\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:13: error: 'i' was not declared in this scope
19 | FOR(i, 1, w + 1) W[i] = i;
| ^
a.cc:19:9: error: 'FOR' was not declared in this scope
19 | FOR(i, 1, w + 1) W[i] = i;
| ^~~
|
s012732102
|
p00011
|
C++
|
#include <iostream>
#include <utility>
using namespace System;
using namespace std;
const int MAX_W = 30;
int main()
{
int w,n;
int num[MAX_W+1]={};
char c;
cin>>w>>n;
for(int i=0;i<w;i++){
num[i]=i+1;
}
int a,b;
for(int i=0;i<n;i++){
cin>>a>>c>>b;
swap(num[a-1],num[b-1]);
}
for(int i=0;i<w;i++){
cout<<num[i]<<endl;
}
return 0;
}
|
a.cc:3:17: error: 'System' is not a namespace-name
3 | using namespace System;
| ^~~~~~
|
s953167007
|
p00011
|
C++
|
#include<iostream>
int main(){
int w,n,a[30][2],b[30];
std::cin>>w
>>n;
for(int i=0;i<n;++i){
std::cin>>a[i][0]>>','>>a[i][1];
}
for(int i=1;i<=w;++i){
b[i]=i;
}
for(int i=0;i<n;++i){
int x=b[a[i][0]];
b[a[i][0]]=b[a[i][1]];
b[a[i][1]]=x;
}
for(int i=1;i<=w;++i){
std::cout<<b[i]<<std::endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:42: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'char')
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ~~~~~~~~~~~~~~~~~^~~~~
| | |
| | char
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'char'
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: invalid conversion from 'char' to 'void*' [-fpermissive]
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
| |
| char
a.cc:7:44: error: cannot bind rvalue '(void*)44' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:7:44: error: invalid conversion from 'char' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
7 | std::cin>>a[i][0]>>','>>a[i][1];
| ^~~
| |
| char
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_Cha
|
s734344578
|
p00011
|
C++
|
#include<stdio.h>
int main(){
int x[32][2]={};
int w,n;
scanf("%d",&w);
scanf("%d",%n);
for(int i=0;i<=w;i++)
x[i][0]=i;
for(int i=0;i<n;i++)
{
int a1,a2;
scanf("%d,%d",&a1,&a2);
int t=x[a1][0];x[a1][0]=x[a2][0];x[a2][0]=t;
}
for(int i=1;i<=w;i++)
printf("%d\n",x[i][0]);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:12: error: expected primary-expression before '%' token
9 | scanf("%d",%n);
| ^
|
s888061010
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int main(){
int w = 0;
cin >> w ;
int n = 0;
cin >> n;
int i = 1;
int a[w];
loop(i = 0,i < w,i++){
a[i] = i + 1;
}
loop(i = 1,i <= n,i++){
int aa = 0;int bb = 0;
char split;
cin >> aa >> split >> bb ;
int c = 0;
c = a[aa - 1];
a[aa - 1] = a[bb - 1];
a[bb - 1] = c;
}
loop(i = 0,i < w, i++)
{
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:1: error: 'loop' was not declared in this scope
11 | loop(i = 0,i < w,i++){
| ^~~~
|
s405849340
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int main(){
int w = 0;
cin >> w ;
int n = 0;
cin >> n;
int i = 1;
int a[w];
for(i = 0,i < w,i++){
a[i] = i + 1;
}
for(i = 1,i <= n,i++){
int aa = 0;int bb = 0;
char split;
cin >> aa >> split >> bb ;
int c = 0;
c = a[aa - 1];
a[aa - 1] = a[bb - 1];
a[bb - 1] = c;
}
for(i = 0,i < w, i++){
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:20: error: expected ';' before ')' token
11 | for(i = 0,i < w,i++){
| ^
| ;
a.cc:14:1: error: expected primary-expression before 'for'
14 | for(i = 1,i <= n,i++){
| ^~~
a.cc:13:2: error: expected ';' before 'for'
13 | }
| ^
| ;
14 | for(i = 1,i <= n,i++){
| ~~~
a.cc:14:1: error: expected primary-expression before 'for'
14 | for(i = 1,i <= n,i++){
| ^~~
a.cc:13:2: error: expected ')' before 'for'
13 | }
| ^
| )
14 | for(i = 1,i <= n,i++){
| ~~~
a.cc:11:4: note: to match this '('
11 | for(i = 0,i < w,i++){
| ^
a.cc:14:21: error: expected ';' before ')' token
14 | for(i = 1,i <= n,i++){
| ^
| ;
a.cc:23:1: error: expected primary-expression before 'for'
23 | for(i = 0,i < w, i++){
| ^~~
a.cc:22:2: error: expected ';' before 'for'
22 | }
| ^
| ;
23 | for(i = 0,i < w, i++){
| ~~~
a.cc:23:1: error: expected primary-expression before 'for'
23 | for(i = 0,i < w, i++){
| ^~~
a.cc:22:2: error: expected ')' before 'for'
22 | }
| ^
| )
23 | for(i = 0,i < w, i++){
| ~~~
a.cc:14:4: note: to match this '('
14 | for(i = 1,i <= n,i++){
| ^
a.cc:23:21: error: expected ';' before ')' token
23 | for(i = 0,i < w, i++){
| ^
| ;
a.cc:26:5: error: expected primary-expression before 'return'
26 | return 0;
| ^~~~~~
a.cc:25:2: error: expected ';' before 'return'
25 | }
| ^
| ;
26 | return 0;
| ~~~~~~
a.cc:26:5: error: expected primary-expression before 'return'
26 | return 0;
| ^~~~~~
a.cc:25:2: error: expected ')' before 'return'
25 | }
| ^
| )
26 | return 0;
| ~~~~~~
a.cc:23:4: note: to match this '('
23 | for(i = 0,i < w, i++){
| ^
|
s693436265
|
p00011
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
using namespace std;
const int MAX_HORIZONTAL = 30;
const int MAX_VERTICAL = 30;
int main(){
int VerticalLines;
int HorizontalLines;
int HorizonA[MAX_HORIZONTAL];
int HorizonB[MAX_HORIZONTAL];
int Results[MAX_VERTICAL];
cin >> VerticalLines;
cin >> HorizontalLines;
for (int i = 0; i < HorizontalLines; ++i){ char c[32]; scanf_s("%d,%d", &HorizonA[i], &HorizonB[i]); }
for (int i = 0; i < VerticalLines; ++i){ Results[i] = i + 1; }
for (int i = 0; i < HorizontalLines; ++i){
int Swap = Results[HorizonA[i] - 1];
Results[HorizonA[i]-1] = Results[HorizonB[i] - 1];
Results[HorizonB[i] - 1] = Swap;
}
for (int i = 0; i < VerticalLines; ++i){
cout << Results[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:26:65: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
26 | for (int i = 0; i < HorizontalLines; ++i){ char c[32]; scanf_s("%d,%d", &HorizonA[i], &HorizonB[i]); }
| ^~~~~~~
| scanf
|
s761980057
|
p00011
|
C++
|
w = input()
n = input()
k = []
for i in range(w+1):
k.append(i)
for i in range(n):
l = raw_input()
a = int(l[0])
b = int(l[2])
temp = k[a]
k[a] = k[b]
k[b] = temp
for i in range(w):
print k[i+1]
|
a.cc:2:1: error: 'w' does not name a type
2 | w = input()
| ^
|
s083226688
|
p00011
|
C++
|
int main(){
int w, n;
int num[30] = { 0 };
int a, b;
cin >> w;
cin >> n;
for (int i = 0; i<w; i++)
num[i] = i + 1;
for (int i = 0; i<n; i++){
cin >> a >> b;
int tmp = num[a-1];
num[a-1] = num[b-1];
num[b-1] = tmp;
}
for (int i = 0; i<w; i++)
cout << num[i] << "\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin >> w;
| ^~~
a.cc:26:17: error: 'cout' was not declared in this scope
26 | cout << num[i] << "\n";
| ^~~~
|
s105580968
|
p00011
|
C++
|
#include <iostream>
using namespace std;
int main(){
int w, n;
int num[30] = { 0 };
int a, b;
char c
cin >> w;
cin >> n;
for (int i = 0; i<w; i++)
num[i] = i + 1;
for (int i = 0; i<n; i++){
cin >> a >> c >> b;
int tmp = num[a-1];
num[a-1] = num[b-1];
num[b-1] = tmp;
}
for (int i = 0; i<w; i++)
cout << num[i] << "\n";
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:9: error: expected initializer before 'cin'
11 | cin >> w;
| ^~~
a.cc:19:29: error: 'c' was not declared in this scope
19 | cin >> a >> c >> b;
| ^
|
s191001600
|
p00011
|
C++
|
#define _CRT_SECURE_NO_WARNINGS 1
#include <cstdio>
using namespace std;
int main()
{
int W, N, A[31], B[31], C[31];
cin >> W >> N;
for (int i = 1; i <= N; i++)
{
scanf("%d,%d", &(A[i]), &(B[i]));
}
for (int i = 1; i <= W; i++)
{
int t = i;
for (int j = 1; j <= N; j++)
{
if (A[j] == t)
{
t = B[j];
}
else if (B[j] == t)
{
t = A[j];
}
}
C[t] = i;
}
for (int i = 1; i <= W; i++)
{
printf("%d\n", C[i]);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
11 | cin >> W >> N;
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <cstdio>
+++ |+#include <iostream>
4 |
|
s059951718
|
p00011
|
C++
|
include<iostream>
#include<cstdio>
using namespace std;
void change(int *, int *);
int main(void){
int w,n;
int p[31];
int a, b;
cin >> w;
cin >> n;
for(int i = 1; i <= w; i++){
p[i] = i;
}
for(int j = 0; j < n; j++){
scanf("%d,%d", &a, &b);
change(&p[a], &p[b]);
}
for(int i = 1; i <= w; i++){
cout << p[i] << endl;
}
return 0;
}
void change(int *x, int *y){
int type = *x;
*x = *y;
*y = type;
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
12 | cin >> w;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<cstdio>
+++ |+#include <iostream>
3 |
a.cc:25:17: error: 'cout' was not declared in this scope
25 | cout << p[i] << endl;
| ^~~~
a.cc:25:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:33: error: 'endl' was not declared in this scope
25 | cout << p[i] << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include<cstdio>
+++ |+#include <ostream>
3 |
|
s237805126
|
p00011
|
C++
|
#include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
int main()
{
int n, w;
int a[30], b[30],c[30];
cin >> w;
cin >> n;
for (int i = 0; i < n; i++) {
scanf_s("%d,%d", &a[i], &b[i]);
}
for (int i = 1; i <= w; i++) {
c[i] = i;
}
for (int i = 0; i < n; i++) {
swap(c[a[i]], c[b[i]]);
}
for (int i = 1; i <= w; i++) {
cout << c[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:24:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
24 | scanf_s("%d,%d", &a[i], &b[i]);
| ^~~~~~~
| scanf
|
s985436049
|
p00011
|
C++
|
ude <iostream>
const int W_MAX = 30;
const int N_MAX = 30;
int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];
void chenge(int *farst, int *second){
int tmp;
tmp = *farst;
*farst = *second;
*second = tmp;
}
int main(void){
std::ios_sync_with(false);
std::cin.tie(0);
std::cin >> w;
std::cin >> n;
for(int i = 0; i <= w; i++){
out[i] = i;
}
for(int i = 1; i <= n; i++){
std::cin >> a[i] >> b[i];
chenge(&out[a[i]], &out[b[i]]);
}
for(int i = 1; i <= w; i++){
std::cout << out[i] << ' ';
}
std::cout << '/n';
return 0;
}
|
a.cc:39:22: warning: multi-character character constant [-Wmultichar]
39 | std::cout << '/n';
| ^~~~
a.cc:1:1: error: 'ude' does not name a type
1 | ude <iostream>
| ^~~
a.cc:10:9: error: 'W_MAX' was not declared in this scope; did you mean 'N_MAX'?
10 | int out[W_MAX + 1];
| ^~~~~
| N_MAX
a.cc: In function 'int main()':
a.cc:20:14: error: 'ios_sync_with' is not a member of 'std'
20 | std::ios_sync_with(false);
| ^~~~~~~~~~~~~
a.cc:21:14: error: 'cin' is not a member of 'std'
21 | std::cin.tie(0);
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | ude <iostream>
a.cc:23:14: error: 'cin' is not a member of 'std'
23 | std::cin >> w;
| ^~~
a.cc:23:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:14: error: 'cin' is not a member of 'std'
24 | std::cin >> n;
| ^~~
a.cc:24:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:17: error: 'out' was not declared in this scope
27 | out[i] = i;
| ^~~
a.cc:31:22: error: 'cin' is not a member of 'std'
31 | std::cin >> a[i] >> b[i];
| ^~~
a.cc:31:22: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:25: error: 'out' was not declared in this scope
32 | chenge(&out[a[i]], &out[b[i]]);
| ^~~
a.cc:36:22: error: 'cout' is not a member of 'std'
36 | std::cout << out[i] << ' ';
| ^~~~
a.cc:36:22: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:36:30: error: 'out' was not declared in this scope
36 | std::cout << out[i] << ' ';
| ^~~
a.cc:39:14: error: 'cout' is not a member of 'std'
39 | std::cout << '/n';
| ^~~~
a.cc:39:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s778190296
|
p00011
|
C++
|
#include <iostream>
const int W_MAX = 30;
const int N_MAX = 30;
int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];
void chenge(int *farst, int *second){
int tmp;
tmp = *farst;
*farst = *second;
*second = tmp;
}
int main(void){
std::ios_sync_with(false);
std::cin.tie(0);
std::cin >> w;
std::cin >> n;
for(int i = 0; i <= w; i++){
out[i] = i;
}
for(int i = 1; i <= n; i++){
std::cin >> a[i] >> b[i];
chenge(&out[a[i]], &out[b[i]]);
}
for(int i = 1; i <= w; i++){
std::cout << out[i] << ' ';
}
std::cout << '/n';
return 0;
}
|
a.cc:39:22: warning: multi-character character constant [-Wmultichar]
39 | std::cout << '/n';
| ^~~~
a.cc: In function 'int main()':
a.cc:20:14: error: 'ios_sync_with' is not a member of 'std'
20 | std::ios_sync_with(false);
| ^~~~~~~~~~~~~
|
s896704810
|
p00011
|
C++
|
#include <iostream>
const int W_MAX = 30;
const int N_MAX = 30;
int w;
int n;
int a[N_MAX + 1];
int b[N_MAX + 1];
int out[W_MAX + 1];
void chenge(int *farst, int *second){
int tmp;
tmp = *farst;
*farst = *second;
*second = tmp;
}
int main(void){
ios::sync_with_stdio(false);
std::cin.tie(0);
std::cin >> w;
std::cin >> n;
for(int i = 0; i <= w; i++){
out[i] = i;
}
for(int i = 1; i <= n; i++){
std::cin >> a[i] >> b[i];
chenge(&out[a[i]], &out[b[i]]);
}
for(int i = 1; i <= w; i++){
std::cout << out[i] << ' ';
}
std::cout << '/n';
return 0;
}
|
a.cc:39:22: warning: multi-character character constant [-Wmultichar]
39 | std::cout << '/n';
| ^~~~
a.cc: In function 'int main()':
a.cc:20:9: error: 'ios' has not been declared
20 | ios::sync_with_stdio(false);
| ^~~
|
s832443227
|
p00011
|
C++
|
w=gets.to_i
n=gets.to_i
a=[*0..w]
n.times{b,c=gets.chomp.split(',').map(&:to_i);a[b],a[c]=a[c],a[b]}
puts a[1..w]
|
a.cc:3:5: error: too many decimal points in number
3 | a=[*0..w]
| ^~~~
a.cc:5:8: error: too many decimal points in number
5 | puts a[1..w]
| ^~~~
a.cc:1:1: error: 'w' does not name a type
1 | w=gets.to_i
| ^
a.cc:5:1: error: 'puts' does not name a type
5 | puts a[1..w]
| ^~~~
|
s158933250
|
p00011
|
C++
|
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>
#include <cmath>
int main(void)
{
int w, n;
std::cin >> w >> n;
std::vector<int> base;
for (int i = 0; i < w; i++) {
base.push_back(i + 1);
}
for (int i = 0; i < n; i++) {
int a, b;
scanf_s("%d,%d", &a, &b);
std::swap(base[a - 1], base[b - 1]);
}
for (int i = 0; i < w; i++) {
std::cout << base[i] << std::endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:22:5: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
22 | scanf_s("%d,%d", &a, &b);
| ^~~~~~~
| scanf
|
s951933184
|
p00011
|
C++
|
w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
|
a.cc:1:10: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^~~~~~~~~~~
a.cc:1:35: error: too many decimal points in number
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^~~~
a.cc:1:112: error: too many decimal points in number
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^~~~
a.cc:1:1: error: 'w' does not name a type
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^
a.cc:1:22: error: 'n' does not name a type
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^
a.cc:1:31: error: 'a' does not name a type
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^
a.cc:1:41: error: 'n' does not name a type
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^
a.cc:1:105: error: 'puts' does not name a type
1 | w=eval s='gets.to_i';n=eval s;a=[*0..w];n.times{b,c=gets.chop.split(?,).map &:to_i;a[b],a[c]=a[c],a[b]};puts a[1..w]
| ^~~~
|
s902350685
|
p00011
|
C++
|
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
int main() {
int w,n;
cin>>w>>n;
int c[31];
for(int i=1;i<=w;i++)c[i]=i;
for(int i=1;i<=n;i++){
int a,b;
scanf_s("%d,%d",&a,&b);
swap(c[a],c[b]);
}
for(int i=1;i<=w;i++)cout<<c[i]<<endl;
}
|
a.cc: In function 'int main()':
a.cc:20:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
20 | scanf_s("%d,%d",&a,&b);
| ^~~~~~~
| scanf
|
s209643365
|
p00011
|
C++
|
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
int main() {
int w,n;
cin>>w>>n;
int c[31];
for(int i=1;i<=w;i++)c[i]=i;
for(int i=1;i<=n;i++){
int a,b;
scanf_s("%d,%d",&a,&b);
swap(c[a],c[b]);
}
for(int i=1;i<=w;i++)cout<<c[i]<<endl;
}
|
a.cc: In function 'int main()':
a.cc:21:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
21 | scanf_s("%d,%d",&a,&b);
| ^~~~~~~
| scanf
|
s298727378
|
p00011
|
C++
|
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
int w;
while (cin >> w) {
vector<int> vec;
vec.resize(w);
// default
for (int i = 0; i < vec.size(); ++i) {
vec[i] = i + 1;
}
int n;
cin >> n;
cin.ignore(INT_MAX, '\n');
for (int i = 0; i < n; ++i) {
string str, tmp_a, tmp_b;
int a, b;
getline(cin, str);
istringstream iss(str);
getline(iss, tmp_a, ',');
getline(iss, tmp_b, ',');
a = stoi(tmp_a) - 1;
b = stoi(tmp_b) - 1;
int tmp = vec[a];
vec[a] = vec[b];
vec[b] = tmp;
}
for (int i = 0; i < vec.size(); ++i) {
cout << vec[i] << endl;
}
} // while loop out
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:16: error: 'INT_MAX' was not declared in this scope
16 | cin.ignore(INT_MAX, '\n');
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <sstream>
+++ |+#include <climits>
4 | using namespace std;
|
s193917574
|
p00011
|
C++
|
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
int w;
while (cin >> w) {
vector<int> vec;
vec.resize(w);
// default
for (int i = 0; i < vec.size(); ++i) {
vec[i] = i + 1;
}
int n;
cin >> n;
cin.ignore(INT_MAX, '\n');
for (int i = 0; i < n; ++i) {
string str, tmp_a, tmp_b;
int a, b;
getline(cin, str);
istringstream iss(str);
getline(iss, tmp_a, ',');
getline(iss, tmp_b, ',');
a = stoi(tmp_a) - 1;
b = stoi(tmp_b) - 1;
int tmp = vec[a];
vec[a] = vec[b];
vec[b] = tmp;
}
for (int i = 0; i < vec.size(); ++i) {
cout << vec[i] << endl;
}
} // while loop out
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:16: error: 'INT_MAX' was not declared in this scope
16 | cin.ignore(INT_MAX, '\n');
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <sstream>
+++ |+#include <climits>
4 | using namespace std;
|
s130945930
|
p00011
|
C++
|
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
int w;
while (cin >> w) {
vector<int> vec;
vec.resize(w);
// default
for (int i = 0; i < vec.size(); ++i) {
vec[i] = i + 1;
}
int n;
cin >> n;
cin.ignore(INT_MAX, '\n');
for (int i = 0; i < n; ++i) {
string str, tmp_a, tmp_b;
int a, b;
getline(cin, str);
istringstream iss(str);
getline(iss, tmp_a, ',');
getline(iss, tmp_b, ',');
a = stoi(tmp_a) - 1;
b = stoi(tmp_b) - 1;
int tmp = vec[a];
vec[a] = vec[b];
vec[b] = tmp;
}
for (int i = 0; i < vec.size(); ++i) {
cout << vec[i] << endl;
}
} // while loop out
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:16: error: 'INT_MAX' was not declared in this scope
16 | cin.ignore(INT_MAX, '\n');
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <sstream>
+++ |+#include <climits>
4 | using namespace std;
|
s135770402
|
p00011
|
C++
|
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
int w;
while (cin >> w) {
vector<int> vec;
vec.resize(w);
for (int i = 0; i < vec.size(); ++i) {
vec[i] = i + 1;
}
int n;
cin >> n;
cin.ignore(INT_MAX, '\n');
for (int i = 0; i < n; ++i) {
string str, tmp_a, tmp_b;
int a, b;
getline(cin, str);
istringstream iss(str);
getline(iss, tmp_a, ',');
getline(iss, tmp_b, ',');
a = stoi(tmp_a) - 1;
b = stoi(tmp_b) - 1;
int tmp = vec[a];
vec[a] = vec[b];
vec[b] = tmp;
}
for (int i = 0; i < vec.size(); ++i) {
cout << vec[i] << endl;
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:16: error: 'INT_MAX' was not declared in this scope
15 | cin.ignore(INT_MAX, '\n');
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <sstream>
+++ |+#include <climits>
4 | using namespace std;
|
s461683257
|
p00011
|
C++
|
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
int w;
while (cin >> w) {
vector<int> vec;
vec.resize(w);
// default
for (int i = 0; i < vec.size(); ++i) {
vec[i] = i + 1;
}
int n;
cin >> n;
cin.ignore(INT_MAX, '\n');
for (int i = 0; i < n; ++i) {
}
for (int i = 0; i < vec.size(); ++i) {
cout << vec[i] << endl;
}
} // while loop out
return 0;
}
|
a.cc: In function 'int main()':
a.cc:16:16: error: 'INT_MAX' was not declared in this scope
16 | cin.ignore(INT_MAX, '\n');
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include <sstream>
+++ |+#include <climits>
4 | using namespace std;
|
s228983235
|
p00011
|
C++
|
#include<iostream>
#include<stdio.h>
#define N 30
using namespace std;
int main(){
????int w,n,tmp;
????int lod[N]; int lis[N][3];
????while(cin >> n >> w){
????for(int i = 0;i<n;i++){
????????lod[i] = i+1;
????}
??
????for(int i=0;i<w;i++){
????????scanf("%d,%d",&lis[i][0],&lis[i][2]);
????}
????for(int i=0;i<w;i++){
????????tmp = lod[lis[i][0]-1];
????????lod[lis[i][0]-1] = lod[lis[i][2]-1];
????????lod[lis[i][2]-1] = tmp;
????}
????for(int i=0;i<n;i++){
????????cout << lod[i] << endl;
????}
????}
}
|
a.cc: In function 'int main()':
a.cc:6:1: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:4: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:4: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:8:1: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:2: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:3: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:4: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
|
s266652493
|
p00011
|
C++
|
#include<iostream>
#include<stdio.h>
#define N 30
using namespace std;
int main(){
????int w,n,tmp;
????int lod[N]; int lis[N][3];
????while(cin >> n >> w){
????for(int i = 0;i<n;i++){
????lod[i] = i+1;
????}
????for(int i=0;i<w;i++){
????scanf("%d,%d",&lis[i][0],&lis[i][2]);
????}
????for(int i=0;i<w;i++){
????tmp = lod[lis[i][0]-1];
????lod[lis[i][0]-1] = lod[lis[i][2]-1];
????lod[lis[i][2]-1] = tmp;
????}
????for(int i=0;i<n;i++){
????cout << lod[i] << endl;
????}
}
|
a.cc: In function 'int main()':
a.cc:6:1: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:4: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:4: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:8:1: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:2: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:3: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:4: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:23:2: error: expected '}' at end of input
23 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s269390896
|
p00011
|
C++
|
#include<iostream>
#include<stdio.h>
#define N 30
using namespace std;
int main(){
????int w,n,tmp;
????int lod[N]; int lis[N][3];
????while(cin >> n >> w){
????for(int i = 0;i<n;i++){
????lod[i] = i+1;
????}
????for(int i=0;i<w;i++){
????scanf("%d,%d",&lis[i][0],&lis[i][2]);
????}
????for(int i=0;i<w;i++){
????tmp = lod[lis[i][0]-1];
????lod[lis[i][0]-1] = lod[lis[i][2]-1];
????lod[lis[i][2]-1] = tmp;
????}
????for(int i=0;i<n;i++){
????cout << lod[i] << endl;
????}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:1: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:4: error: expected primary-expression before '?' token
6 | ????int w,n,tmp;
| ^
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:6:5: error: expected ':' before 'int'
6 | ????int w,n,tmp;
| ^~~
| :
a.cc:6:5: error: expected primary-expression before 'int'
6 | ????int w,n,tmp;
| ^~~
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:4: error: expected primary-expression before '?' token
7 | ????int lod[N]; int lis[N][3];
| ^
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:7:5: error: expected ':' before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
| :
a.cc:7:5: error: expected primary-expression before 'int'
7 | ????int lod[N]; int lis[N][3];
| ^~~
a.cc:8:1: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:2: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:3: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:4: error: expected primary-expression before '?' token
8 | ????while(cin >> n >> w){
| ^
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:8:5: error: expected ':' before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
| :
a.cc:8:5: error: expected primary-expression before 'while'
8 | ????while(cin >> n >> w){
| ^~~~~
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s350793845
|
p00011
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
int w, n, i, x, y, z;
char str[10], *a, *b;
cin >> w >> n;
vector<int> A(w);
for (i = 0; i < w; i++) A[i] = i + 1;
for (i = 0; i < n; i++) {
cin >> str;
a = strtok(str, ",");
x = atoi(a);
b = strtok(NULL, ",");
y = atoi(b);
z = A[x - 1];
A[x-1] = A[y-1]; A[y-1] = z;
}
for (i = 0; i < w; i++) cout << A[i] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:21: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
14 | a = strtok(str, ",");
| ^~~~~~
| strtoq
|
s586569234
|
p00011
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
int w, n, i, x, y, z;
char str[10], *a, *b;
cin >> w >> n;
vector<int> A(w);
for (i = 0; i < w; i++) A[i] = i + 1;
for (i = 0; i < n; i++) {
cin >> str;
a = strtok_s(str, ",");
x = atoi(a);
b = strtok_s(NULL, ",");
y = atoi(b);
z = A[x - 1];
A[x-1] = A[y-1]; A[y-1] = z;
}
for (i = 0; i < w; i++) cout << A[i] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:21: error: 'strtok_s' was not declared in this scope; did you mean 'strtol_l'?
14 | a = strtok_s(str, ",");
| ^~~~~~~~
| strtol_l
|
s006555884
|
p00011
|
C++
|
#include <iostream>
using namespace std;
int main(){
int w, n;
cin >> w >> n;
int s[w];
for(int i=0; i<w; i++){
s[i] = i+1;
while(n--){
int a, b, c;
cin >> a >> b;
int tmp = s[a-1];
s[a-1] = s[b-1];
s[b-1] = tmp;
}
for(int i=0; i<w; i++){
cout << s[i];
}
cout << endl;
}
|
a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
25 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s244437250
|
p00011
|
C++
|
a = (1..gets.to_i).to_a
gets.to_i.times{
x,y = gets.split(",").map(&:to_i)
a[x-1], a[y-1] = a[y-1], a[x-1]
}
puts a
|
a.cc:1:6: error: too many decimal points in number
1 | a = (1..gets.to_i).to_a
| ^~~~~~~~~~~~
a.cc:1:1: error: 'a' does not name a type
1 | a = (1..gets.to_i).to_a
| ^
a.cc:6:1: error: 'puts' does not name a type
6 | puts a
| ^~~~
|
s273018888
|
p00011
|
C++
|
#include<iostream>
#include<stdio.h>
using namespace std;
int main(void) {
//0011
int Line[31], w=0, n=0, a, b, tmp;
cin >> w;
cin >> n;
for (int i=0; i < 30; i++) {
Line[i] = i;
}
for (int j = 0; j < n; j++) {
scanf_s("%d,%d", &a, &b);
tmp = Line[a];
Line[a] = Line[b];
Line[b] = tmp;
}
for (int k = 1; k <= w; k++) {
cout << Line[k] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
17 | scanf_s("%d,%d", &a, &b);
| ^~~~~~~
| scanf
|
s250247383
|
p00011
|
C++
|
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main(void) {
//0011
int Line[31], w=0, n=0, a, b, tmp;
cin >> w;
cin >> n;
for (int i=0; i < 30; i++) {
Line[i] = i;
}
for (int j = 0; j < n; j++) {
scanf_s("%d,%d", &a, &b);
tmp = Line[a];
Line[a] = Line[b];
Line[b] = tmp;
}
for (int k = 1; k <= w; k++) {
cout << Line[k] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
18 | scanf_s("%d,%d", &a, &b);
| ^~~~~~~
| scanf
|
s922942605
|
p00011
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int w,n; cin >> w >> n;
int a[31];
rep(i,0,w) a[i] = i+1;
rep(i,0,n) {
int x,y;
scanf("%d,%d",x,y);
swap(a[x-1],a[y-1]);
}
rep(i,0,n) cout << a[i] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:5: error: 'i' was not declared in this scope
7 | rep(i,0,w) a[i] = i+1;
| ^
a.cc:7:1: error: 'rep' was not declared in this scope
7 | rep(i,0,w) a[i] = i+1;
| ^~~
|
s232538143
|
p00011
|
C++
|
#include <bits/stdc++.h>
#define rep(i,a,n) for(inti =a; i<n; i++)
using namespace std;
int main() {
int w,n; cin >> w >> n;
int a[31];
rep(i,0,w) a[i] = i+1;
rep(i,0,n) {
int x,y;
scanf("%d,%d",&x,&y);
swap(a[x-1],a[y-1]);
}
rep(i,0,n) cout << a[i] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:2:24: error: 'inti' was not declared in this scope; did you mean 'int'?
2 | #define rep(i,a,n) for(inti =a; i<n; i++)
| ^~~~
a.cc:8:1: note: in expansion of macro 'rep'
8 | rep(i,0,w) a[i] = i+1;
| ^~~
a.cc:8:5: error: 'i' was not declared in this scope
8 | rep(i,0,w) a[i] = i+1;
| ^
a.cc:2:33: note: in definition of macro 'rep'
2 | #define rep(i,a,n) for(inti =a; i<n; i++)
| ^
a.cc:2:24: error: 'inti' was not declared in this scope; did you mean 'int'?
2 | #define rep(i,a,n) for(inti =a; i<n; i++)
| ^~~~
a.cc:10:1: note: in expansion of macro 'rep'
10 | rep(i,0,n) {
| ^~~
a.cc:10:5: error: 'i' was not declared in this scope
10 | rep(i,0,n) {
| ^
a.cc:2:33: note: in definition of macro 'rep'
2 | #define rep(i,a,n) for(inti =a; i<n; i++)
| ^
a.cc:2:24: error: 'inti' was not declared in this scope; did you mean 'int'?
2 | #define rep(i,a,n) for(inti =a; i<n; i++)
| ^~~~
a.cc:15:1: note: in expansion of macro 'rep'
15 | rep(i,0,n) cout << a[i] << endl;
| ^~~
a.cc:15:5: error: 'i' was not declared in this scope
15 | rep(i,0,n) cout << a[i] << endl;
| ^
a.cc:2:33: note: in definition of macro 'rep'
2 | #define rep(i,a,n) for(inti =a; i<n; i++)
| ^
|
s205393339
|
p00011
|
C++
|
//#define scanf_s scanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 30
int main(void)
{
int w, n, a, b, x;
int list[MAX] = { 0 };
scanf_s("%d", &w);
scanf_s("%d", &n);
for (int i = 0; i < w;++i) {
list[i] = i + 1;
}
for (int i = 0; i < n; ++i) {
scanf_s("%d,%d", &a, &b);
x = list[a - 1]; list[a - 1] = list[b - 1]; list[b - 1] = x;
}
for (int i = 0; i < w; ++i) {
printf("%d\n", list[i]);
}
}
|
a.cc: In function 'int main()':
a.cc:12:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
12 | scanf_s("%d", &w);
| ^~~~~~~
| scanf
|
s724644765
|
p00011
|
C++
|
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int x[30],w;
cin >> w;
for(int i = 1; i <= w; i++){
x[i] = i;
}
int n, a, b;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a >> "," >> b;
swap(x[a],x[b]);
}
for(int i = 1; i <= w; i++){
cout << x[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:15:26: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'const char [2]')
15 | cin >> a >> "," >> b;
| ~~~~~~~~ ^~ ~~~
| | |
| | const char [2]
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'const char*'
15 | cin >> a >> "," >> b;
| ^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'short int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(short int)((const char*)",")' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'short unsigned int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(short unsigned int)((const char*)",")' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(int)((const char*)",")' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'unsigned int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(unsigned int)((const char*)",")' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'long int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(long int)((const char*)",")' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'long unsigned int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(long unsigned int)((const char*)",")' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'long long int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(long long int)((const char*)",")' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const char*' to 'long long unsigned int' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const char*
a.cc:15:29: error: cannot bind rvalue '(long long unsigned int)((const char*)",")' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:29: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
15 | cin >> a >> "," >> b;
| ^~~
| |
| const void*
a.cc:15:29: error: cannot bind rvalue '(void*)((const void*)((const char*)","))' to 'void*&'
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'const char [2]' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'const char [2]' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'const char [2]' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'const char [2]' to 'std::basic_istream<char>::__istream_type&
|
s576732509
|
p00011
|
C++
|
#include <iostream>
#include<STRING>
using namespace std;
int main() {
int line;
int side;
int sidenum1,sidenum2;
int linenum[line];
char waste;
cin>>line>>side;
for(int i=0; i<line; i++){
linenum[i]=i+1;
}
for(int i=0; i<side; i++){
cin>>sidenum1>>waste>>sidenum2;
swap(linenum[sidenum1-1],linenum[sidenum2-1]);
}
for(int i=0; i<line; i++){
cout<<linenum[i]<<endl;
}
return 0;
}
|
a.cc:3:9: fatal error: STRING: No such file or directory
3 | #include<STRING>
| ^~~~~~~~
compilation terminated.
|
s990356756
|
p00011
|
C++
|
#include<iostream>
#include<stdio.h>
#include<string>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<string.h>
#include<cctype>
#include<map>
#include<set>
#include<vector>
#include<sstream>
using namespace std;
int v[35];
int main()
{
int w,n;
cin>>w>>n;
for(int i=1;i<=w;i++) v[i]=i;
while(n--)
{
int l,r;
char temp
cin>>l>>temp>>r;
swap(v[l],v[r]);
}
for(int i=1;i<=w;i++)
{
cout<<v[i]<<endl;
}
//while(1);
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:6: error: expected initializer before 'cin'
27 | cin>>l>>temp>>r;
| ^~~
|
s187719415
|
p00011
|
C++
|
using namespace std;
pair<int, int> p;
int a[31];
int main()
{
int w, n, r;
cin >> w >> n;
for (int i = 1; i < w + 1; i++)
a[i] = i;
for (int i = 0; i < n; i++)
{
scanf("%d,%d", p.first, p.second);
r = a[p.first];
a[p.first] = a[p.second];
a[p.second] = r;
}
for (int i = 1; i < w + 1; i++)
{
cout << a[i] << endl;
}
return 0;
}
|
a.cc:3:1: error: 'pair' does not name a type
3 | pair<int, int> p;
| ^~~~
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope
9 | cin >> w >> n;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:14:32: error: 'p' was not declared in this scope
14 | scanf("%d,%d", p.first, p.second);
| ^
a.cc:14:17: error: 'scanf' was not declared in this scope
14 | scanf("%d,%d", p.first, p.second);
| ^~~~~
a.cc:21:17: error: 'cout' was not declared in this scope
21 | cout << a[i] << endl;
| ^~~~
a.cc:21:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:21:33: error: 'endl' was not declared in this scope
21 | cout << a[i] << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
|
s533535916
|
p00011
|
C++
|
#include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
pair<int, int> p;
int a[31];
int main()
{
int w, n, r;
cin >> w >> n;
for (int i = 1; i < w + 1; i++)
a[i] = i;
for (int i = 0; i < n; i++)
{
scanf_s("%d,%d", &p.first, &p.second);
r = a[p.first];
a[p.first] = a[p.second];
a[p.second] = r;
}
for (int i = 1; i < w + 1; i++)
{
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
21 | scanf_s("%d,%d", &p.first, &p.second);
| ^~~~~~~
| scanf
|
s411882936
|
p00011
|
C++
|
#include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
pair<int, int> p;
int a[31];
int main()
{
int w, n, r;
cin >> w >> n;
for (int i = 1; i < w + 1; i++)
a[i] = i;
for (int i = 0; i < n; i++)
{
scanf_s("%d,%d", &p.first, &p.second);
r = a[p.first];
a[p.first] = a[p.second];
a[p.second] = r;
}
for (int i = 1; i < w + 1; i++)
{
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
21 | scanf_s("%d,%d", &p.first, &p.second);
| ^~~~~~~
| scanf
|
s351757467
|
p00011
|
C++
|
#include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
pair<int, int> p;
int a[31];
int main()
{
int w, n, r;
cin >> w >> n;
for (int i = 1; i < w + 1; i++)
a[i] = i;
for (int i = 0; i < n; i++)
{
scanf_s("%d,%d", &p.first, &p.second);
r = a[p.first];
a[p.first] = a[p.second];
a[p.second] = r;
}
for (int i = 1; i < w + 1; i++)
{
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
21 | scanf_s("%d,%d", &p.first, &p.second);
| ^~~~~~~
| scanf
|
s797230018
|
p00011
|
C++
|
#include<iostream>
void swap(int a,int b){
int t=a;
a=b;
b=t;
return ;
}
int main(){
int w;
int n;
int c[30];
int a[30];
int b[30];
scanf("%d",&w);
scanf("%d",&n);
for(int i=0;i<w;i++){
c[i]=i;
}
for(int i=0;i<n;i++){
scanf("%d%d",&a[i],&b[i]);
swap(c[a[i]],c[b[i]]);
}
for(int i=0;i<w;i++){
cout<<c[i]<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:24:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
24 | cout<<c[i]<<endl;
| ^~~~
| std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:24:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
24 | cout<<c[i]<<endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s870320781
|
p00011
|
C++
|
include <bits/stdc++.h>
using namespace std;
int main() {
int w,n;
scanf("%d %d",&w,&n);
int a[n];
int b[n];
for(int i=0;i<n;i++){
scanf("%d,%d",&a[i],&b[i]);
}
int ans[w+1];
for(int i=1;i<=w;i++)ans[i]=i;
int temp;
for(int i=0;i<n;i++){
temp=ans[a[i]];
ans[a[i]]=ans[b[i]];
ans[b[i]]=temp;
}
for(int i=1;i<=w;i++){
cout<<ans[i]<<endl;
}
return 0;
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf' was not declared in this scope
6 | scanf("%d %d",&w,&n);
| ^~~~~
a.cc:21:17: error: 'cout' was not declared in this scope
21 | cout<<ans[i]<<endl;
| ^~~~
a.cc:21:31: error: 'endl' was not declared in this scope
21 | cout<<ans[i]<<endl;
| ^~~~
|
s109127783
|
p00011
|
C++
|
/*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES
#include <iostream> // ?¨??????\??????
#include <fstream> // ??????????????\??????
#include <string> // ???????????¢???
#include <vector> // ???????????????
#include <cmath> // ??°??????
#include <iomanip> // stream???????????¢???
#include <algorithm>// max??¢??°??????
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector; // ????´???°????????????????????????
using std::fixed; // ???????????????????¨???????????????????????????????
using std::setprecision; // ?????°????°???°?????\???????????°????????????????????¨????????\???
void out1(vector<int> a) {
for (size_t i = 0; i < a.size(); i++)
{
cout << a[i] << " ";
}
cout << endl;
}
int main() {
int w, n;
cin >> w; // ???????????°
cin >> n; // ?¨?????????°
vector<int> begin(n);
vector<int> end(n);
vector<int> location(w);
int num1 = 0;
int num2 = 0;
// ??\???
for (size_t i = 0; i < n; i++)
{
scanf_s("%d,%d", &begin[i], &end[i]);
cout << begin[i] << end[i] << endl;
}
// location????????????
for (size_t i = 0; i < w; i++)
{
location[i] = i + 1;
}
// ????????\??¬????????§????????????
for (size_t i = 0; i < w; i++)
{
vector<int> tmp(w,0);
out1(tmp);
tmp[i] = location[i];
cout << "----i = " << i << "?????¨???----" << endl;
for (size_t j = 0; j < n; j++)
{
if (begin[j] == location[i])
{
cout << begin[j] << "???" << end[j] << "?????\???????????????" << endl;
location[i] = end[j];
}
else if (end[j] == location[i])
{
cout << end[j] << "???" << begin[j] << "?????\???????????????" << endl;
location[i] = begin[j];
}
out1(location);
}
}
// ???????????????
vector<int> output(w,0);
for (size_t i = 0; i < w; i++)
{
output[location[i]-1] = i;
}
// ???????????¨???????????????????????°??????1????¶????
for (size_t i = 0; i < w; i++)
{
cout << output[i]+1 << endl;
}
return 0;
}
|
a.cc:61:52: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
61 | cout << "----i = " << i << "?????¨???----" << endl;
a.cc: In function 'int main()':
a.cc:44:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
44 | scanf_s("%d,%d", &begin[i], &end[i]);
| ^~~~~~~
| scanf
|
s757829167
|
p00011
|
C++
|
/*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES
#include <iostream> // ?¨??????\??????
#include <fstream> // ??????????????\??????
#include <string> // ???????????¢???
#include <vector> // ???????????????
#include <cmath> // ??°??????
#include <iomanip> // stream???????????¢???
#include <algorithm>// max??¢??°??????
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector; // ????´???°????????????????????????
using std::fixed; // ???????????????????¨???????????????????????????????
using std::setprecision; // ?????°????°???°?????\???????????°????????????????????¨????????\???
void out1(vector<int> a) {
for (size_t i = 0; i < a.size(); i++)
{
cout << a[i] << " ";
}
cout << endl;
}
int main() {
int w, n;
cin >> w; // ???????????°
cin >> n; // ?¨?????????°
vector<int> begin(n);
vector<int> end(n);
vector<int> location(w);
int num1 = 0;
int num2 = 0;
// ??\???
for (size_t i = 0; i < n; i++)
{
scanf_s("%d,%d", &begin[i], &end[i]);
cout << begin[i] << end[i] << endl;
}
// location????????????
for (size_t i = 0; i < w; i++)
{
location[i] = i + 1;
}
// ????????\??¬????????§????????????
for (size_t i = 0; i < w; i++)
{
vector<int> tmp(w,0);
out1(tmp);
tmp[i] = location[i];
cout << "----i = " << i << "?????¨???----" << endl;
for (size_t j = 0; j < n; j++)
{
if (begin[j] == location[i])
{
cout << begin[j] << "???" << end[j] << "?????\???????????????" << endl;
location[i] = end[j];
}
else if (end[j] == location[i])
{
cout << end[j] << "???" << begin[j] << "?????\???????????????" << endl;
location[i] = begin[j];
}
out1(location);
}
}
// ???????????????
vector<int> output(w,0);
for (size_t i = 0; i < w; i++)
{
output[location[i]-1] = i;
}
// ???????????¨???????????????????????°??????1????¶????
for (size_t i = 0; i < w; i++)
{
cout << output[i]+1 << endl;
}
return 0;
}
|
a.cc:61:52: warning: trigraph ??- ignored, use -trigraphs to enable [-Wtrigraphs]
61 | cout << "----i = " << i << "?????¨???----" << endl;
a.cc: In function 'int main()':
a.cc:44:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
44 | scanf_s("%d,%d", &begin[i], &end[i]);
| ^~~~~~~
| scanf
|
s859005672
|
p00011
|
C++
|
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>
#include <chrono>
using namespace std;
class amida
{
int w;
vector<int> va;
public:
amida(int _w) : w(_w){
for(int i = 0; i < w; i++){
va.push_back(i);
}
}
void swap(int, int);
void output();
};
void amida::swap(int a1, int b1)
{
int temp = va[a1-1];
va[a1-1] = va[b1-1];
va[b1-1] = temp;
}
void amida::output()
{
for(int i = 0; i < w; i++)
cout << va[i]+1 << '\n';
}
int main()
{
int w, n;
int a1, b1;
cin >> w;
amida am(w);
cin >> n;
for(int i = 0; i < n; i++){
string str;
cin >> str;
const char* chtemp = str.c_str();
char *ct;
a1 = atoi(strtok_s((char*)chtemp, ",", &ct));
b1 = atoi(strtok_s(NULL, ",", &ct));
am.swap(a1, b1);
}
am.output();
return 0;
}
|
a.cc: In function 'int main()':
a.cc:54:27: error: 'strtok_s' was not declared in this scope; did you mean 'strtok_r'?
54 | a1 = atoi(strtok_s((char*)chtemp, ",", &ct));
| ^~~~~~~~
| strtok_r
|
s861200724
|
p00011
|
C++
|
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int a[100]={},w,n,a,b,i;
cin >> w;
for(i=1;i<=w;i++){
a[i] = i;
}
cin >> n;
for(i=1;i<=n;i++){
scanf("%d,%d",&a,&b);
swap(a[a],a[b]);
}
for(int i=1;i<=w;i++){
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:23: error: conflicting declaration 'int a'
7 | int a[100]={},w,n,a,b,i;
| ^
a.cc:7:9: note: previous declaration as 'int a [100]'
7 | int a[100]={},w,n,a,b,i;
| ^
a.cc:15:15: error: invalid types 'int [100][int [100]]' for array subscript
15 | swap(a[a],a[b]);
| ^
|
s910194716
|
p00011
|
C++
|
#include<stdio.h>
using namespace std;
const int MAX = 100;
int main() {
int W, N;
int t[MAX];
cin >> W >> N;
for (int i = 0; i < W; i++) {
t[i] = i;
}
for (int i = 0; i < N; i++) {
int a, b;
scanf("%d,%d", &a, &b); a--; b--;
swap(t[a], t[b]);
}
for (int i = 0; i < W; i++) {
printf("%d\n", t[i] + 1);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
8 | cin >> W >> N;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<stdio.h>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:15:17: error: 'swap' was not declared in this scope
15 | swap(t[a], t[b]);
| ^~~~
|
s994464540
|
p00011
|
C++
|
#include <cmath>
#include <cstdio>
using namespace std;
void lots(int len,int a,int b,int array[]){
int buffer[5];
for(int i = 0;i < len; i++){
if(i == a-1){
buffer[i] = array[b-1];
}
else if(i == b-1){
buffer[i] = array[a-1];
}
else{
buffer[i] = array[i];
}
}
for(int i = 0; i < len; i++){
array[i] = buffer[i];
}
}
int main(){
int len,duration,a,b;
cin >> len;
cin >> duration;
int array[len];
for(int i = 0; i < len; i++){
array[i] = i+1;
}
for(int i = 0; i < duration; i++){
scanf("%d,%d",&a,&b);
lots(len,a,b,array);
}
for(int i = 0; i < len; i++){
cout << array[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:26:5: error: 'cin' was not declared in this scope
26 | cin >> len;
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <cstdio>
+++ |+#include <iostream>
3 |
a.cc:37:9: error: 'cout' was not declared in this scope
37 | cout << array[i] << endl;
| ^~~~
a.cc:37:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:29: error: 'endl' was not declared in this scope
37 | cout << array[i] << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include <cstdio>
+++ |+#include <ostream>
3 |
|
s173946329
|
p00011
|
C++
|
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>
using namespace std;
int main() {
int w, n;
int change[30][2];
int line[30];
cin >> w >> n;
for (int i = 0; i < n; ++i) {
scanf_s("%d,%d", &change[i][0], &change[i][1]);
}
for (int i = 0; i < w; ++i) {
line[i] = i + 1;
}
for (int i = 0; i < n; ++i) {
swap(line[change[i][0] - 1], line[change[i][1] - 1]);
//for (int i = 0; i < w; ++i) {
// cout << line[i] << " ";
//}
//cout << endl;
//cout << "--------------------------" << endl;
}
for (int i = 0; i < w; ++i) {
cout << line[i] << endl;;
}
}
|
a.cc: In function 'int main()':
a.cc:14:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
14 | scanf_s("%d,%d", &change[i][0], &change[i][1]);
| ^~~~~~~
| scanf
|
s340610651
|
p00011
|
C++
|
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++)
int w, n;
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
cin >> w >> n;
ll a[32];
roop(i, 32) {
a[i] = i + 1;
}
roop(i, n) {
string s;
cin >> s;
string d[2];
roop(i, s.length) {
if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
}
int swap[2];
roop(i, 2) {
swap[i] = stoi(d[i]);
}
int before = a[swap[0] - 1];
a[swap[0] - 1] = a[swap[1] - 1];
a[swap[1] - 1] = before;
}
roop(i, n) {
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:42:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
42 | roop(i, s.length) {
| ~~^~~~~~
a.cc:27:33: note: in definition of macro 'roop'
27 | #define roop(a,t) for(int a=0;a<t;a++)
| ^
|
s882186591
|
p00011
|
C++
|
// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
ll w, n;
cin.tie(0);
ios::sync_with_stdio(false);
cin >> w >> n;
ll a[32];
roop(i, 32) {
a[i] = i + 1;
}
roop(i, n) {
string s;
cin >> s;
string d[2];
roop(i, s.length) {
if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
}
ll swap[2];
roop(i, 2) {
swap[i] = stoi(d[i]);
}
ll before = a[swap[0] - 1];
a[swap[0] - 1] = a[swap[1] - 1];
a[swap[1] - 1] = before;
}
roop(i, n) {
cout << a[i] << endl;
}
return 0;
}
|
a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s360869760
|
p00011
|
C++
|
// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
ll w, n;
cin.tie(0);
ios::sync_with_stdio(false);
cin >> w >> n;
ll a[32];
roop(i, 32) {
a[i] = i + 1;
}
roop(i, n) {
string s;
cin >> s;
string d[2];
roop(i, s.length) {
if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
}
ll swap[2];
roop(i, 2) {
swap[i] = stoi(d[i]);
}
ll before = a[swap[0] - 1];
a[swap[0] - 1] = a[swap[1] - 1];
a[swap[1] - 1] = before;
}
roop(i, n) {
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:46:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
46 | roop(i, s.length) {
| ~~^~~~~~
a.cc:30:33: note: in definition of macro 'roop'
30 | #define roop(a,t) for(ll a=0;a<t;a++)
| ^
|
s104958260
|
p00011
|
C++
|
// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++)
int main()
{
int w, n;
cin.tie(0);
ios::sync_with_stdio(false);
cin >> w >> n;
int a[32];
roop(i, 32) {
a[i] = i + 1;
}
roop(i, n) {
string s;
cin >> s;
string d[2];
roop(i, s.length) {
if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
}
int swap[2];
roop(i, 2) {
swap[i] = stoi(d[i]);
}
int before = a[swap[0] - 1];
a[swap[0] - 1] = a[swap[1] - 1];
a[swap[1] - 1] = before;
}
roop(i, n) {
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:44:27: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
44 | roop(i, s.length) {
| ~~^~~~~~
a.cc:28:33: note: in definition of macro 'roop'
28 | #define roop(a,t) for(int a=0;a<t;a++)
| ^
|
s433338428
|
p00011
|
C++
|
// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ld long double
int main()
{
int w, n;
cin.tie(0);
ios::sync_with_stdio(false);
cin >> w >> n;
int a[32];
for (int i = 0; i < 32; i++)
{
a[i] = i + 1;
}
for (int i = 0; i < n; i++) {
string s;
cin >> s;
string d[2];
for (int i = 0; i < s.length; i++) {
if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
}
int swap[2];
for (int i = 0; i < 2; i++) {
swap[i] = stoi(d[i]);
}
int before = a[swap[0] - 1];
a[swap[0] - 1] = a[swap[1] - 1];
a[swap[1] - 1] = before;
}
for (int i = 0; i < n; i++) {
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:42:39: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
42 | for (int i = 0; i < s.length; i++) {
| ~~^~~~~~
| ()
|
s782315795
|
p00011
|
C++
|
// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
ll w, n;
cin.tie(0);
ios::sync_with_stdio(false);
cin >> w >> n;
ll a[32];
roop(i, 32) {
a[i] = i + 1;
}
roop(i, n) {
string s;
cin >> s;
string d[2];
roop(i, s.length()) {
if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
}
ll swap[2];
roop(i, 2) {
swap[i] = stoll(d[i]);
}
ll before = a[swap[0] - 1];
a[swap[0] - 1] = a[swap[1] - 1];
a[swap[1] - 1] = before;
}
roop(i, n) {
cout << a[i] << endl;
}
return 0;
}
|
a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s436513103
|
p00011
|
C++
|
// 0011.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
#include <typeinfo>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(ll a=0;a<t;a++)
int main()
{
ll w, n;
cin.tie(0);
ios::sync_with_stdio(false);
cin >> w >> n;
ll a[32];
roop(i, 32) {
a[i] = i + 1;
}
roop(i, n) {
string s;
cin >> s;
string d[2];
roop(i, s.length()) {
if (s[i] == ',') { d[0] = s.substr(0, i); d[i] = s.substr(i + 1); break; }
}
ll swap[2];
roop(i, 2) {
swap[i] = stoll(d[i]);
}
ll before = a[swap[0] - 1];
a[swap[0] - 1] = a[swap[1] - 1];
a[swap[1] - 1] = before;
}
roop(i, n) {
cout << a[i] << endl;
}
return 0;
}
|
a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s663528780
|
p00011
|
C++
|
include<iostream>
using namespace std;
int main(){
int w,n,tmp;
cin>>w>>n;
int a[w];
string s;
for(int i=0;i<w;i++) a[i]=i+1;
for(int i=0;i<n;i++){
cin>>s;
int x=s[0]-(int)'1',y=s[2]-(int)'1';
tmp=a[x];
a[x]=a[y];
a[y]=tmp;
}
for(int i=0;i<w;i++) cout<<a[i]<<endl;
return 0;
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
5 | cin>>w>>n;
| ^~~
a.cc:7:5: error: 'string' was not declared in this scope
7 | string s;
| ^~~~~~
a.cc:10:14: error: 's' was not declared in this scope
10 | cin>>s;
| ^
a.cc:13:16: error: 'y' was not declared in this scope
13 | a[x]=a[y];
| ^
a.cc:16:26: error: 'cout' was not declared in this scope
16 | for(int i=0;i<w;i++) cout<<a[i]<<endl;
| ^~~~
a.cc:16:38: error: 'endl' was not declared in this scope
16 | for(int i=0;i<w;i++) cout<<a[i]<<endl;
| ^~~~
|
s705482067
|
p00011
|
C++
|
#include<iostream>
#include<vector>
#include<utility>
#include<cstdio>
int main(void){
int w,n;
std::cin>>w;
std::vector<int> state(w+1);
for(int i=1;i<=w;i++) state[i]=i;
std::cin>>n;
int a,b;
for(int i=0;i<n;i++){
scanf("%d,%d",&a,&b);
std::swap(state[a[i]],state[b[i]]);
}
for(int i=1;i<=w;i++) std::cout<<w[i]<<std::endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:26: error: invalid types 'int[int]' for array subscript
15 | std::swap(state[a[i]],state[b[i]]);
| ^
a.cc:15:38: error: invalid types 'int[int]' for array subscript
15 | std::swap(state[a[i]],state[b[i]]);
| ^
a.cc:17:39: error: invalid types 'int[int]' for array subscript
17 | for(int i=1;i<=w;i++) std::cout<<w[i]<<std::endl;
| ^
|
s938353930
|
p00011
|
C++
|
#include<iostream>
#include<vector>
#include<utility>
#include<cstdio>
int main(void){
int w,n;
std::cin>>w;
std::vector<int> state(w+1);
for(int i=1;i<=w;i++) state[i]=i;
std::cin>>n;
int a,b;
for(int i=0;i<n;i++){
scanf("%d,%d",&a,&b);
std::swap(state[a],state[b]);
}
for(int i=1;i<=w;i++) std::cout<<w[i]<<std::endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:39: error: invalid types 'int[int]' for array subscript
17 | for(int i=1;i<=w;i++) std::cout<<w[i]<<std::endl;
| ^
|
s103559840
|
p00011
|
C++
|
#include <iostream>
#include <string>
#include <sstring>
using namespace std;
int main(){
int w, n;
int d[31];
while(cin >> w >> n){
for(int i=1;i<=w;i++) d[i] = i;
for(int i=0;i<n;i++){
string s; cin >> s;
istringstream iss >> s;
for(int j=0;j<s.size();j++)
if(s[j]==',') s[j] = ' ';
int a, b; iss >> a >> b;
swap(d[a], d[b]);
}
for(int i=1;i<=w;i++) cout << d[i] << endl;
}
}
|
a.cc:3:10: fatal error: sstring: No such file or directory
3 | #include <sstring>
| ^~~~~~~~~
compilation terminated.
|
s589962919
|
p00011
|
C++
|
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main(){
int w, n;
int d[31];
while(cin >> w >> n){
for(int i=1;i<=w;i++) d[i] = i;
for(int i=0;i<n;i++){
string s; cin >> s;
istringstream iss >> s;
for(int j=0;j<s.size();j++)
if(s[j]==',') s[j] = ' ';
int a, b; iss >> a >> b;
swap(d[a], d[b]);
}
for(int i=1;i<=w;i++) cout << d[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:14:31: error: expected initializer before '>>' token
14 | istringstream iss >> s;
| ^~
a.cc:17:23: error: 'iss' was not declared in this scope
17 | int a, b; iss >> a >> b;
| ^~~
|
s305231453
|
p00011
|
C++
|
#include <stdio.h>
using namespace std;
int main(){
int w, n;
int d[31];
char s[30];
while(~scanf("%d %d", &w, &n)){
for(int i=1;i<=w;i++) d[i] = i;
for(int i=0;i<n;i++){
scanf("%s", s);
int a, b;
sscanf(s, "%d,%d", &a, &b);
swap(d[a], d[b]);
}
for(int i=1;i<=w;i++) cout << d[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:15:13: error: 'swap' was not declared in this scope
15 | swap(d[a], d[b]);
| ^~~~
a.cc:17:31: error: 'cout' was not declared in this scope
17 | for(int i=1;i<=w;i++) cout << d[i] << endl;
| ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <stdio.h>
+++ |+#include <iostream>
2 |
a.cc:17:47: error: 'endl' was not declared in this scope
17 | for(int i=1;i<=w;i++) cout << d[i] << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <stdio.h>
+++ |+#include <ostream>
2 |
|
s109532951
|
p00011
|
C++
|
/*
Let's play Amidakuji.
In the following example, there are five vertical lines and four horizontal lines. The horizontal lines can intersect (jump across) the vertical lines.
[picture]
In the starting points (top of the figure), numbers are assigned to vertical lines in ascending order from left to right. At the first step, 2 and 4 are swaped by the first horizontal line which connects second and fourth vertical lines (we call this operation (2, 4)). Likewise, we perform (3, 5), (1, 2) and (3, 4), then obtain "4 1 2 5 3" in the bottom.
Your task is to write a program which reads the number of vertical lines w and configurations of horizontal lines and prints the final state of the Amidakuji. In the starting pints, numbers 1, 2, 3, ..., w are assigne to the vertical lines from left to right.
*/
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int w; cin >> w;
int n; cin >> n;
int a,b;
vector<int> ans(w);
for (int i=0; i<w; i++)
ans[i] = i+1;
for (int i=0; i<n; i++) {
scanf("%d, %d\n", &a, &b)
swap(ans[a-1], ans[b-1]);
}
for (int i=0; i<w; i++)
cout << ans[i] << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:28:42: error: expected ';' before 'swap'
28 | scanf("%d, %d\n", &a, &b)
| ^
| ;
29 | swap(ans[a-1], ans[b-1]);
| ~~~~
|
s762059591
|
p00011
|
C++
|
#include <cstdio>
#include <algorithm>
int main(){
int array[50];
int w,n,a,b;
for(int i=0 ; i<50 ; i++){
array[i] = i;
}
scanf("%d", &w);
scanf("%d", &n);
for(int i=0 ; i<n ; i++){
scanf("%d,%d", &a, &b);
swap( array[a] , array[b] );
}
for(int i=1 ; i<=w ; i++){
printf("%d\n", array[i]);
}
}
|
a.cc: In function 'int main()':
a.cc:16:17: error: 'swap' was not declared in this scope
16 | swap( array[a] , array[b] );
| ^~~~
a.cc:16:17: note: suggested alternatives:
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:1106:5: note: 'std::swap'
1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61:
/usr/include/c++/14/bits/move.h:226:5: note: 'std::swap'
226 | swap(_Tp& __a, _Tp& __b)
| ^~~~
/usr/include/c++/14/bits/move.h:226:5: note: 'std::swap'
|
s503053248
|
p00011
|
C++
|
#include <stdio.h>
void swap(int *a, int *b){
int c=*a;
*a=*b;
*b=c;
return;
}
int main(void)
{
int w,n;
scanf("%d",&w);
int list[w];
scanf("%d",&n);
for(int i=0;i<n;i++){
int a,b;
scanf("%d,%d",&a,&b);
swap(list[a],list[b]);
}
for(int i=0;i<w;i++){
printf("%d\n",list[i]);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:12: error: invalid conversion from 'int' to 'int*' [-fpermissive]
19 | swap(list[a],list[b]);
| ~~~~~~^
| |
| int
a.cc:3:16: note: initializing argument 1 of 'void swap(int*, int*)'
3 | void swap(int *a, int *b){
| ~~~~~^
a.cc:19:20: error: invalid conversion from 'int' to 'int*' [-fpermissive]
19 | swap(list[a],list[b]);
| ~~~~~~^
| |
| int
a.cc:3:24: note: initializing argument 2 of 'void swap(int*, int*)'
3 | void swap(int *a, int *b){
| ~~~~~^
|
s022614154
|
p00011
|
C++
|
#include<stdio.h>
int main(void){
int w,n,x,y,temp;
int a[31];
char str[7];
for(int i = 0; i < 31; i++){
a[i] = i;
}
scanf("%d %d",&w,&n);
for(int i = 0; i < n; i++){
getline(str);
if(str[3] == ',')
str[3] = ' ';
else
str[2] = ' ';
sscanf(str,"%d %d",&x,&y);
temp = a[x];
a[x] = a[y];
a[y] = temp;
}
for(int i = 0; i < w; i++){
printf("%d\n",&a[i + 1];
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:25: error: cannot convert 'char*' to 'char**'
11 | getline(str);
| ^~~
| |
| char*
In file included from a.cc:1:
/usr/include/stdio.h:697:45: note: initializing argument 1 of '__ssize_t getline(char**, size_t*, FILE*)'
697 | extern __ssize_t getline (char **__restrict __lineptr,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:23:40: error: expected ')' before ';' token
23 | printf("%d\n",&a[i + 1];
| ~ ^
| )
|
s442835127
|
p00011
|
C++
|
#include<stdio.h>
int main(void){
int w,n,x,y,temp;
int a[31];
char str[7];
for(int i = 0; i < 31; i++){
a[i] = i;
}
scanf("%d %d",&w,&n);
for(int i = 0; i < n; i++){
getline(str,6);
if(str[3] == ',')
str[3] = ' ';
else
str[2] = ' ';
sscanf(str,"%d %d",&x,&y);
temp = a[x];
a[x] = a[y];
a[y] = temp;
}
for(int i = 0; i < w; i++){
printf("%d\n",&a[i + 1]);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:25: error: cannot convert 'char*' to 'char**'
11 | getline(str,6);
| ^~~
| |
| char*
In file included from a.cc:1:
/usr/include/stdio.h:697:45: note: initializing argument 1 of '__ssize_t getline(char**, size_t*, FILE*)'
697 | extern __ssize_t getline (char **__restrict __lineptr,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~
|
s127787270
|
p00011
|
C++
|
#include<stdio.h>
int main(void){
int w,n,x,y,temp;
int a[31];
char str[7];
for(int i = 0; i < 31; i++){
a[i] = i;
}
scanf("%d %d",&w,&n);
for(int i = 0; i < n; i++){
gets(str,6);
if(str[3] == ',')
str[3] = ' ';
else
str[2] = ' ';
sscanf(str,"%d %d",&x,&y);
temp = a[x];
a[x] = a[y];
a[y] = temp;
}
for(int i = 0; i < w; i++){
printf("%d\n",&a[i + 1]);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
11 | gets(str,6);
| ^~~~
| getw
|
s857700564
|
p00011
|
C++
|
#include<iostream>
int main(void){
int w,n,x,y,temp;
int a[31];
char c;
string str;
istringstream is(str);
for(int i = 0; i < 31; i++){
a[i] = i;
}
scanf("%d %d",&w,&n);
for(int i = 0; i < n; i++){
getline(str,7);
is >> x >> c >> y;
temp = a[x];
a[x] = a[y];
a[y] = temp;
}
for(int i = 0; i < w; i++){
cout << a[i + 1] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
6 | string str;
| ^~~~~~
a.cc:6:9: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:7:9: error: 'istringstream' was not declared in this scope; did you mean 'std::istringstream'?
7 | istringstream is(str);
| ^~~~~~~~~~~~~
| std::istringstream
/usr/include/c++/14/iosfwd:152:41: note: 'std::istringstream' declared here
152 | typedef basic_istringstream<char> istringstream;
| ^~~~~~~~~~~~~
a.cc:13:25: error: 'str' was not declared in this scope; did you mean 'std'?
13 | getline(str,7);
| ^~~
| std
a.cc:14:17: error: 'is' was not declared in this scope; did you mean 'i'?
14 | is >> x >> c >> y;
| ^~
| i
a.cc:21:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
21 | cout << a[i + 1] << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:21:37: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
21 | cout << a[i + 1] << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s561498878
|
p00011
|
C++
|
#include<iostream>
using namespace std;
int main(void){
int w,n,x,y,temp;
int a[31];
char c;
string str;
istringstream is(str);
for(int i = 0; i < 31; i++){
a[i] = i;
}
scanf("%d %d",&w,&n);
for(int i = 0; i < n; i++){
getline(str,7);
is >> x >> c >> y;
temp = a[x];
a[x] = a[y];
a[y] = temp;
}
for(int i = 0; i < w; i++){
cout << a[i + 1] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:29: error: variable 'std::istringstream is' has initializer but incomplete type
9 | istringstream is(str);
| ^
a.cc:15:24: error: no matching function for call to 'getline(std::string&, int)'
15 | getline(str,7);
| ~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.tcc:907:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
907 | getline(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:907:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:4117:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4117 | getline(basic_istream<_CharT, _Traits>& __is,
| ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4117:5: note: template argument deduction/substitution failed:
a.cc:15:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
15 | getline(str,7);
| ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4125:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
4125 | getline(basic_istream<_CharT, _Traits>&& __is,
| ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4125:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:4132:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4132 | getline(basic_istream<_CharT, _Traits>&& __is,
| ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4132:5: note: template argument deduction/substitution failed:
a.cc:15:24: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
15 | getline(str,7);
| ~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/cstdio:42,
from /usr/include/c++/14/ext/string_conversions.h:45,
from /usr/include/c++/14/bits/basic_string.h:4154:
/usr/include/stdio.h:697:18: note: candidate: '__ssize_t getline(char**, size_t*, FILE*)'
697 | extern __ssize_t getline (char **__restrict __lineptr,
| ^~~~~~~
/usr/include/stdio.h:697:18: note: candidate expects 3 arguments, 2 provided
|
s964745502
|
p00011
|
C++
|
#include<iostream>
#include<vector>
int main()
{
int w,n;
char c;
cin >> w >> n;
vector<int> a(n);
vector<int> b(n);
vector<int> x(w);
for(int i=0;i<n;i++)
{
std::cin >> a[i] >> c >> b[i];
}
for(int i=0;i<w;i++)
{
x[i]=i+1;
}
for(int i=0;i<n;i++)
{
int temp = x[a[i]-1];
x[a[i]-1]=x[b[i]-1];
x[b[i]-1]=temp;
}
for(int i=0;i<w;++i)
{
cout << x[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:10:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
10 | cin >> w >> n;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:12:2: error: 'vector' was not declared in this scope
12 | vector<int> a(n);
| ^~~~~~
a.cc:12:2: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:12:9: error: expected primary-expression before 'int'
12 | vector<int> a(n);
| ^~~
a.cc:14:12: error: expected primary-expression before 'int'
14 | vector<int> b(n);
| ^~~
a.cc:16:12: error: expected primary-expression before 'int'
16 | vector<int> x(w);
| ^~~
a.cc:20:21: error: 'a' was not declared in this scope
20 | std::cin >> a[i] >> c >> b[i];
| ^
a.cc:20:34: error: 'b' was not declared in this scope
20 | std::cin >> a[i] >> c >> b[i];
| ^
a.cc:25:9: error: 'x' was not declared in this scope
25 | x[i]=i+1;
| ^
a.cc:30:20: error: 'x' was not declared in this scope
30 | int temp = x[a[i]-1];
| ^
a.cc:30:22: error: 'a' was not declared in this scope
30 | int temp = x[a[i]-1];
| ^
a.cc:32:21: error: 'b' was not declared in this scope
32 | x[a[i]-1]=x[b[i]-1];
| ^
a.cc:39:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
39 | cout << x[i] << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:39:15: error: 'x' was not declared in this scope
39 | cout << x[i] << endl;
| ^
a.cc:39:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
39 | cout << x[i] << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s568306642
|
p00011
|
C++
|
#include<iostream>
#include<vector>
int main()
{
int w,n;
char c;
cin >> w >> n;
vector<int> a(n);
vector<int> b(n);
vector<int> x(w);
for(int i=0;i<n;++i)
{
std::cin >> a[i] >> c >> b[i];
}
for(int i=0;i<w;++i)
{
x[i]=i+1;
}
for(int i=0;i<n;++i)
{
int temp = x[a[i]-1];
x[a[i]-1]=x[b[i]-1];
x[b[i]-1]=temp;
}
for(int i=0;i<w;++i)
{
cout << x[i] << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:10:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
10 | cin >> w >> n;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:12:2: error: 'vector' was not declared in this scope
12 | vector<int> a(n);
| ^~~~~~
a.cc:12:2: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:12:9: error: expected primary-expression before 'int'
12 | vector<int> a(n);
| ^~~
a.cc:14:12: error: expected primary-expression before 'int'
14 | vector<int> b(n);
| ^~~
a.cc:16:12: error: expected primary-expression before 'int'
16 | vector<int> x(w);
| ^~~
a.cc:20:21: error: 'a' was not declared in this scope
20 | std::cin >> a[i] >> c >> b[i];
| ^
a.cc:20:34: error: 'b' was not declared in this scope
20 | std::cin >> a[i] >> c >> b[i];
| ^
a.cc:25:9: error: 'x' was not declared in this scope
25 | x[i]=i+1;
| ^
a.cc:30:20: error: 'x' was not declared in this scope
30 | int temp = x[a[i]-1];
| ^
a.cc:30:22: error: 'a' was not declared in this scope
30 | int temp = x[a[i]-1];
| ^
a.cc:32:21: error: 'b' was not declared in this scope
32 | x[a[i]-1]=x[b[i]-1];
| ^
a.cc:39:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
39 | cout << x[i] << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:39:15: error: 'x' was not declared in this scope
39 | cout << x[i] << endl;
| ^
a.cc:39:23: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
39 | cout << x[i] << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s760122656
|
p00011
|
C++
|
#include <cstdio>
#include <iostream>
#include <algorhythm>
using namespace std;
int main()
{
int w,n;
int c[]={0};
int a,b;
// int temp;
scanf("%d",&w);
scanf("%d",&n);
for(int i=0; i<=n; i++){
c[i]=i;
}
for(int i=0; i<n; i++){
scanf("%d,%d", &a,&b);
swap(c[a], c[b]);
}
for(int i=1; i<=w; i++){
printf("%d\n",c[i]);
}
}
|
a.cc:3:10: fatal error: algorhythm: No such file or directory
3 | #include <algorhythm>
| ^~~~~~~~~~~~
compilation terminated.
|
s380805779
|
p00011
|
C++
|
#include <cstdio>
#include <iostream>
#include <algorhythm.h>
using namespace std;
int main()
{
int w,n;
int c[]={0};
int a,b;
// int temp;
scanf("%d",&w);
scanf("%d",&n);
for(int i=0; i<=n; i++){
c[i]=i;
}
for(int i=0; i<n; i++){
scanf("%d,%d", &a,&b);
swap(c[a], c[b]);
}
for(int i=1; i<=w; i++){
printf("%d\n",c[i]);
}
}
|
a.cc:3:10: fatal error: algorhythm.h: No such file or directory
3 | #include <algorhythm.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s697349353
|
p00011
|
C++
|
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
double dist(double x1, double y1, double x2, double y2){
return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
int main(){
int w, n;
char bar[10];
vector<int> a(31);
const char delim = ',';
int left, right;
for(int i = 1; i <= 30; i++){
a[i] = i;
}
cin >> w >> n;
while(n--){
cin >> bar;
left = atoi(strtok(bar, &delim));
right = atoi(strtok(NULL, &delim));
swap(a[left], a[right]);
}
for(int i = 1; i <= w; i++){
cout << a[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:29: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
27 | left = atoi(strtok(bar, &delim));
| ^~~~~~
| strtoq
|
s258644497
|
p00011
|
C++
|
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int widthCount = 0, heightCount = 0;
string tmp;
cin >> widthCount >> heightCount;
vector<int> width(widthCount);
for(int i = 0; i < widthCount; i++){
width[i] = i + 1;
}
pair<int,int> height;
/*height.first = vector<int>(heightCount,0);
height.second = vector<int>(heightCount,0);*/
char *a = new char[4];
char *tp;
for(int i = 0; i < heightCount; i++){
cin >> tmp;
strcpy(a,tmp.c_str());
tp = strtok(a,",");
height.first = atoi(tp);
tp = strtok(NULL,",");
height.second = atoi(tp);
swap(width[height.first - 1],width[height.second - 1]);
}
for(int i = 0; i < widthCount; i++){
cout << width[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:31:17: error: 'strcpy' was not declared in this scope
31 | strcpy(a,tmp.c_str());
| ^~~~~~
a.cc:7:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <algorithm>
+++ |+#include <cstring>
7 |
a.cc:33:22: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
33 | tp = strtok(a,",");
| ^~~~~~
| strtoq
|
s603499163
|
p00011
|
C++
|
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main(){
int widthCount = 0, heightCount = 0;
string tmp;
cin >> widthCount >> heightCount;
vector<int> width(widthCount);
for(int i = 0; i < widthCount; i++){
width[i] = i + 1;
}
pair<int,int> height;
/*height.first = vector<int>(heightCount,0);
height.second = vector<int>(heightCount,0);*/
char *a = new char[4];
char *tp;
for(int i = 0; i < heightCount; i++){
cin >> tmp;
strcpy(a,tmp.c_str());
tp = strtok(a,",");
height.first = atoi(tp);
tp = strtok(NULL,",");
height.second = atoi(tp);
swap(width[height.first - 1],width[height.second - 1]);
}
for(int i = 0; i < widthCount; i++){
cout << width[i] << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:32:17: error: 'strcpy' was not declared in this scope
32 | strcpy(a,tmp.c_str());
| ^~~~~~
a.cc:8:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include <cstdlib>
+++ |+#include <cstring>
8 |
a.cc:34:22: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
34 | tp = strtok(a,",");
| ^~~~~~
| strtoq
|
s937625935
|
p00011
|
C++
|
#include <iostream>
#include <cstdio>
#include <stdio.h>
using namespace std;
int main(){
int w,n;
int a,b,c;
cin>>w;
cin>>n;
int num[30] = {0};
for(int i=-0;i<w;i++){
num[i] = i+1;
}
for(int j=0;j<n;j++){
scanf_s("%d,%d",&a,&b);
c = num[a-1];
num[a-1] = num[b-1];
num[b-1] = c;
}
for(int k=0;k<w;k++){
printf("%d\n",num[k]);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
15 | scanf_s("%d,%d",&a,&b);
| ^~~~~~~
| scanf
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.