submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s712202922
p00293
C++
#include <iostream> using namespace std; int main(){ int n[101],m[101],a,b,c,nn,mn,i; cin >> nn; if(cin.eof()) return 0; for(i=0;i<nn;i++){ cin >> b; n[i] = b * 100; cin >> b; n[i] += b; } n[i] = 0; cin >> mn; for(i=0;i<mn;i++){ cin >> b; m[i] = b * 100; cin >> b; m[i] += b; } m[i] = 0; a = 0; c = 0; while(a + c < m + n){ if(n[a] == m[c]){ cout << n[a] / 100 << ':' << n[a] - (n[a] / 100 * 100); a++; c++; } else if(n[a] < m[c]){ cout << n[a] / 100 << ':' << n[a] - (n[a] / 100 * 100); a++; } else { cout << m[c] / 100 << ':' << m[c] - (m[c] / 100 * 100); c++; } } return 0; }
a.cc: In function 'int main()': a.cc:25:19: error: invalid operands of types 'int [101]' and 'int [101]' to binary 'operator+' 25 | while(a + c < m + n){ | ~ ^ ~ | | | | | int [101] | int [101]
s291329220
p00293
C++
#include <iostream> using namespace std; int main(){ int N; cin >> N; int bus1[N]; for(int i=0;i<N;i++){ int h,m; cin >> h >> m; bus1[i]=h*60+m; } int M; cin >> M; int bus2[M]; for(int i=0;i<M;i++){ int h,m; cin >> h >> m; bus2[i]=h*60+m; } int n=0,m=0; for(int i=0;i<N+M;i++){ if(bus1[n]<bus2[m]){ int x=bus1[n]%60; cout << (bus1[n]-x)/60 << ":"; if(x<10) cout << "0"; cout << x; if(i!=N+M-1) cout << " "; else{ cout << endl; } n++; } else{ int z=bus2[m]%60; cout << (bus2[m]-z)/60 << ":"; if(z<10) cout << "0"; cout << z; if(i!=N+M-1) cout << " "; else{ cout << endl; m++; } } return 0; }
a.cc: In function 'int main()': a.cc:52:2: error: expected '}' at end of input 52 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s062667698
p00293
C++
#include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int time[210][2]; int main(){ int i,j,n,k; cin>>n; for(i=0;i<n;i++){ cin>>time[i][0]>>time[i][1]; } cin>>k; for(i=n;i<n+k;i++){ cin>>time[i][0]>>time[i][1]; } for(i=0;i<n+k-1;i++){ for(j=n+k-1;j>i;j--){ if(time[i][0]>time[j][0]||time[i][0]==time[j][0]&&time[i][1]>time[j][1]){ swap(time[i][0],time[j][0]); swap(time[i][1],time[j][1]); } } } for(i=0;i<n+k;i++){ if(i>0){ cout<<" "; } if(time[i][1]<10){ printf("%2d:0%d",time[i][0],time[i][1]); } else{ printf("%2d:%d",time[i][0],time[i][1]); } } cout<<endl; return 0; }
a.cc:5:16: error: 'int time [210][2]' redeclared as different kind of entity 5 | int time[210][2]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:10:28: warning: pointer to a function used in arithmetic [-Wpointer-arith] 10 | cin>>time[i][0]>>time[i][1]; | ^ a.cc:10:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 10 | cin>>time[i][0]>>time[i][1]; | ^ a.cc:10:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 10 | cin>>time[i][0]>>time[i][1]; | ~~~^~~~~~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /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:10:31: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 10 | cin>>time[i][0]>>time[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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 10 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:10:31: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' 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:10:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 10 | cin>>ti
s730823256
p00293
C++
#include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int time[210][2]; int a[101][2]; int main(){ int i,j,n,k,c=0,s=0; cin>>n; for(i=0;i<n;i++){ cin>>time[i][0]>>time[i][1]; } cin>>k; for(i=0;i<k;i++){ cin>>a[i][0]>>a[i][1]; } c=n; for(i=0;i<k;i++){ for(j=0;j<n;j++){ if(time[j][0]==a[i][0]&&time[j][1]==a[i][1]){ s=1; } } if(s==0){ time[c][0]=a[i][0]; time[c][1]=a[i][1]; c++; } s=0; } //cout<<c<<endl; for(i=0;i<c;i++){ for(j=c-1;j>i;j--){ if(time[i][0]>time[j][0]||time[i][0]==time[j][0]&&time[i][1]>time[j][1]){ swap(time[i][0],time[j][0]); swap(time[i][1],time[j][1]); } } } for(i=0;i<c;i++){ if(i>0){ cout<<" "; } if(time[i][1]<10){ printf("%2d:0%d",time[i][0],time[i][1]); } else{ printf("%2d:%d",time[i][0],time[i][1]); } } cout<<endl; return 0; }
a.cc:5:16: error: 'int time [210][2]' redeclared as different kind of entity 5 | int time[210][2]; | ^ In file included from /usr/include/pthread.h:23, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157, from /usr/include/c++/14/ext/atomicity.h:35, from /usr/include/c++/14/bits/ios_base.h:39, 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)' 76 | extern time_t time (time_t *__timer) __THROW; | ^~~~ a.cc: In function 'int main()': a.cc:11:28: warning: pointer to a function used in arithmetic [-Wpointer-arith] 11 | cin>>time[i][0]>>time[i][1]; | ^ a.cc:11:31: warning: pointer to a function used in arithmetic [-Wpointer-arith] 11 | cin>>time[i][0]>>time[i][1]; | ^ a.cc:11:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'}) 11 | cin>>time[i][0]>>time[i][1]; | ~~~^~~~~~~~~~~~ | | | | | time_t(time_t*) noexcept {aka long int(long int*) noexcept} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42: /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:11:31: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} 11 | cin>>time[i][0]>>time[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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(short int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'short unsigned int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(short unsigned int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'unsigned int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(unsigned int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(long int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long unsigned int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(long unsigned int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(long long int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'long long unsigned int' [-fpermissive] 11 | cin>>time[i][0]>>time[i][1]; | ~~~~~~~~~^ | | | time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept} a.cc:11:31: error: cannot bind rvalue '(long long unsigned int)(time + ((sizetype)i))' 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:11:31: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive] 11 | cin>>ti
s135647563
p00293
C++
#include"bits/stdc++.h" using namespace std; #define Max 24*60+60+1 int main() { int n, m, n2[101], m2[101]; cin >> n; for (int i = 0; i < 100; i++)n2[i] = Max; for (int i = 0; i < n; i++) { int h, m; cin >> h >> m; n2[i] = h * 60 + m; } cin >> m; for (int i = 0; i < m; i++) { int k, g; cin >> k >> g; n[i+n] = k * 60 + g; } sort(n2, n2 + (m+n)); int suu = 0; for (int i = 0; i < m + n; i++) { if (n2[i] == n2[i + 1]) { for (int j = i+1; n2[i] == n2[j] && n2[j] != Max; j++) { i++; } } if (i != m + n - 1) { printf("%d:%02d ", n2[i] / 60, n2[i] % 60); } else printf("%d:%02d\n", n2[i] / 60, n2[i] % 60); } }
a.cc: In function 'int main()': a.cc:17:18: error: invalid types 'int[int]' for array subscript 17 | n[i+n] = k * 60 + g; | ^
s319559147
p00293
C++
#include<iostream> using namespace std; int main(void){ int n,m,swap; int hour[200],min[200]; cin>>n; for(int i=0;i<n;i++){ cin>>hour[i]>>min[i]; } cin>>m; for(i=0;i<m;i++){ cin>>hour[n+i]>>min[n+i]; } for(i=0;i<n+m-1;i++){ for(int j=i;j<n+m;j++){ if(hour[i]>hour[j]){ swap=hour[i]; hour[i]=hour[j]; hour[j]=swap; swap=min[i]; min[i]=min[j]; min[j]=swap; } else if(hour[i]==hour[j]){ if(min[i]>min[j]){ swap=min[i]; min[i]=min[j]; min[j]=swap; } } } } for(i=0;i<n+m-1;i++){ cout<<hour[i]<<":"<<min[i]<<" "<<flush; } cout<<hour[n+m-1]<<":"<<min[i]<<" "<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:6: error: 'i' was not declared in this scope 11 | for(i=0;i<m;i++){ | ^ a.cc:14:6: error: 'i' was not declared in this scope 14 | for(i=0;i<n+m-1;i++){ | ^ a.cc:33:6: error: 'i' was not declared in this scope 33 | for(i=0;i<n+m-1;i++){ | ^ a.cc:36:30: error: 'i' was not declared in this scope 36 | cout<<hour[n+m-1]<<":"<<min[i]<<" "<<endl; | ^
s010260808
p00293
C++
#include<iostream> using namespace std; int main(void){ int i,n,m,swap; int hour[200],min[200]; cin>>n; for(int i=0;i<n;i++){ cin>>hour[i]>>min[i]; } cin>>m; for(i=0;i<m;i++){ cin>>hour[n+i]>>min[n+i]; } for(i=0;i<n+m-1;i++){ for(int j=i;j<n+m;j++){ if(hour[i]>hour[j]){ swap=hour[i]; hour[i]=hour[j]; hour[j]=swap; swap=min[i]; min[i]=min[j]; min[j]=swap; } else if(hour[i]==hour[j]){ if(min[i]>min[j]){ swap=min[i]; min[i]=min[j]; min[j]=swap; } } } } for(i=0;i<n+m-1;i++){ if(hour[i]==hour[i+1]&&min[i]==min[i+1]){ } else{ cout<<hour[i]<<":"<<min[i]<<" "<<flush; } cout<<hour[n+m]<<":"<<min[n+m]<<" "<<endl; return 0; }
a.cc: In function 'int main()': a.cc:43:2: error: expected '}' at end of input 43 | } | ^ a.cc:3:15: note: to match this '{' 3 | int main(void){ | ^
s144148889
p00293
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<pair<int, int>> po; int n; cin >> n; for (int i = 0; i < n; ++i) { int h, m; cin >> h >> m; po.push_back(make_pair(h, m)); } cin >> n; for (int i = 0; i < n; ++i) { int h, m; cin >> h >> m; po.push_back(make_pair(h, m)); } sort(po.begin(), po.end()); for (int i = 0; i < po.size(); ++i) { printf("%d:%02d%c", po[i].first, po[i].second, (i + 1 == po.size() ? '' : ' ')); } }
a.cc:23:74: error: empty character constant 23 | printf("%d:%02d%c", po[i].first, po[i].second, (i + 1 == po.size() ? '' : ' ')); | ^~
s810701472
p00293
C++
#include<C:\bits\stdc++.h> using namespace std; int main(){ int n,l=0,temp,t[200],h,m; for(int i=0;i<2;i++){ cin >> n; for(int j=0;j<n;j++){ cin >> h >> m; t[l]=h*60+m; l++; } } for(int i=0;i<l-1;i++){ for(int j=i+1;j<l;j++){ if(t[i]>t[j]){ temp=t[i]; t[i]=t[j]; t[j]=temp; } } } int count=0; for(int i=0;i<l;i++){ count++; if(i!=0 && t[i]==t[i-1]){ i++; count--; if(i==l){ cout << endl; break; } } cout << t[i]/60 << ":"; if(t[i]%60<10){ cout << 0; } if(count!=l){ cout<<t[i]%60<<" "; }else{ cout<<t[i]%60; } } }
a.cc:1:9: fatal error: C:\bits\stdc++.h: No such file or directory 1 | #include<C:\bits\stdc++.h> | ^~~~~~~~~~~~~~~~~~ compilation terminated.
s300685488
p00293
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,l=0,temp,t[20000],h,m; for(int i=0;i<2;i++){ cin >> n; for(int j=0;j<n;j++){ cin >> h >> m; t[l]=h*60+m; l++; } } for(int i=0;i<l-1;i++){ for(int j=i+1;j<l;j++){ if(t[i]>t[j]){ swap(t[i],y[j]); } } } int count=0; for(int i=0;i<l;i++){ count++; if(i!=0 && t[i]==t[i-1]){ i++; count--; if(i==l){ break; } } cout << t[i]/60 << ":"; if(t[i]%60<10){ cout << 0; } if(count!=l){ cout<<t[i]%60<<" "; }else{ cout<<t[i]%60; } } cout<<endl; }
a.cc: In function 'int main()': a.cc:16:27: error: 'y' was not declared in this scope 16 | swap(t[i],y[j]); | ^
s640388717
p00293
C++
#include<C:\bits\stdc++.h> using namespace std; int main(){ int n,l=0,temp,t[20000],h,m; for(int i=0;i<2;i++){ cin >> n; for(int j=0;j<n;j++){ cin >> h >> m; t[l]=h*60+m; l++; } } for(int i=0;i<l-1;i++){ for(int j=i+1;j<l;j++){ if(t[i]>t[j]){ swap(t[i],t[j]); } } } int count=0; for(int i=0;i<l;i++){ count++; if(i!=0 && t[i]==t[i-1]){ i++; count--; if(i==l){ break; } } cout << t[i]/60 << ":"; if(t[i]%60<10){ cout << 0; } if(count!=l){ cout<<t[i]%60<<" "; }else{ cout<<t[i]%60; } } cout<<endl; }
a.cc:1:9: fatal error: C:\bits\stdc++.h: No such file or directory 1 | #include<C:\bits\stdc++.h> | ^~~~~~~~~~~~~~~~~~ compilation terminated.
s909062892
p00293
C++
#include<C:\bits\stdc++.h> using namespace std; int main(){ int n,l=0,temp,t[20000],h,m; for(int i=0;i<2;i++){ cin >> n; for(int j=0;j<n;j++){ cin >> h >> m; t[l]=h*60+m; l++; } } for(int i=0;i<l-1;i++){ for(int j=i+1;j<l;j++){ if(t[i]>t[j]){ swap(t[i],t[j]); } } } int count=0; for(int i=0;i<l;i++){ if(i!=0 && t[i]==t[i-1]){ i++; if(i==l){ break; } }else{count++;} if(count==1){ cout << t[i]/60 << ":"; }else{ cout << " " << t[i]/60<< ":"; } if(t[i]%60<10){ cout << 0; } cout<<t[i]%60; } cout<<endl; }
a.cc:1:9: fatal error: C:\bits\stdc++.h: No such file or directory 1 | #include<C:\bits\stdc++.h> | ^~~~~~~~~~~~~~~~~~ compilation terminated.
s097920076
p00293
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s688073155
p00293
C++
#include <stdio.h> #include <algorithm> #include <vector> using namespace std; #define PB push_back struct t{ int hr; int mi; void in(){ scanf("%d%d",&hr,&mi); return ; } void out(){ if(hr<10)printf("0"); printf("%d:",hr); if(mi<10)printf("0"); printf("%d",mi); } } bool cmp(t a,t b){ return a.hr==b.hr?a.mi<b.mi:a.hr<b.hr; } int main(){ int n; t temp; vector<t> v; scanf("%d",&n); while(n--){ temp.in(); v.PB(temp); } scanf("%d",&n); while(n--){ temp.in(); v.PB(temp); } sort(v.begin(),v.end(),cmp); v[0].out(); for(int i=1;i<v.size();i++){ printf(" "); v[i].out(); } printf("\n"); }
a.cc:19:2: error: expected ';' after struct definition 19 | } | ^ | ;
s054081316
p00293
C++
#include<iostream> using namespace std; int main(){ int n,m; int h[100]={},k[100]={},g[100]; for(int i=0;i<100;i++){ g[i]=100000; } cin>>n; for(int i=0;i<n;i++){ cin>>h[i]>>k[i]; } cin>>m; for(int i=n;i<n+m;i++){ cin>>h[i]>>k[i]; } for(int i=0;i<n+m;i++){ g[i]=h[i]*60+k[i]; sort(g,g+n+m); } for(int i=0;i<n+m;i++){ if(g[i]==g[i+1]) continue; cout<<g[i]/60<<":"; if(g[i]%60<10) cout<<"0"<<g[i]%60; else cout<<g[i]%60; if(i!=n+m-1) cout<<" "; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'sort' was not declared in this scope; did you mean 'short'? 19 | sort(g,g+n+m); | ^~~~ | short
s525623578
p00293
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; vector<pair<int,int> > a; cin>>n; while(n--){ int k,g; cin>>k>>g; a.push_back(make_pair(k,g)); } cinn>>m; while(m--){ int k,g; cin>>k>>g; a.push_back(make_pair(k,g)); } sort(a.begin(),a.end()); a.erase(unique(a.begin().a.end()),a.end()); for(size_t i =0;i<a.aize();i++){ printf("%d:%02d",a[i].first,a.[i].second); if(i +1 ==a.size())putchar('\n'); else putchar(' '); } }
a.cc: In function 'int main()': a.cc:16:5: error: 'cinn' was not declared in this scope 16 | cinn>>m; | ^~~~ a.cc:24:30: error: 'std::vector<std::pair<int, int> >::iterator' has no member named 'a' 24 | a.erase(unique(a.begin().a.end()),a.end()); | ^ a.cc:26:25: error: 'class std::vector<std::pair<int, int> >' has no member named 'aize'; did you mean 'size'? 26 | for(size_t i =0;i<a.aize();i++){ | ^~~~ | size a.cc:27:39: error: expected unqualified-id before '[' token 27 | printf("%d:%02d",a[i].first,a.[i].second); | ^
s946060519
p00293
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; vector< pair<int,int> > a; cin>>n; while(n--){ int k,g; cin>>k>>g; a.push_back(make_pair(k,g)); } cin>>m; while(m--){ int k,g; cin>>k>>g; a.push_back(make_pair(k,g)); } sort(a.begin(),a.end()); a.erase(unique(a.begin().a.end()),a.end()); for(size_t i =0;i<a.aize();i++){ printf("%d:%02d",a[i].first,a.[i].second); if(i +1 ==a.size())putchar('\n'); else putchar(' '); } }
a.cc: In function 'int main()': a.cc:24:30: error: 'std::vector<std::pair<int, int> >::iterator' has no member named 'a' 24 | a.erase(unique(a.begin().a.end()),a.end()); | ^ a.cc:26:25: error: 'class std::vector<std::pair<int, int> >' has no member named 'aize'; did you mean 'size'? 26 | for(size_t i =0;i<a.aize();i++){ | ^~~~ | size a.cc:27:39: error: expected unqualified-id before '[' token 27 | printf("%d:%02d",a[i].first,a.[i].second); | ^
s895064982
p00293
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; vector< pair<int,int> > a; cin>>n; while(n--){ int k,g; cin>>k>>g; a.push_back(make_pair(k,g)); } cin>>m; while(m--){ int k,g; cin>>k>>g; a.push_back(make_pair(k,g)); } sort(a.begin(),a.end()); a.erase(unique(a.begin().a.end()),a.end()); for(size_t i =0;i<a.aize();i++){ printf("%d:%02d",a[i].first,a.[i].second); if(i +1 ==a.size())putchar('\n'); else putchar(' '); } }
a.cc: In function 'int main()': a.cc:24:30: error: 'std::vector<std::pair<int, int> >::iterator' has no member named 'a' 24 | a.erase(unique(a.begin().a.end()),a.end()); | ^ a.cc:26:25: error: 'class std::vector<std::pair<int, int> >' has no member named 'aize'; did you mean 'size'? 26 | for(size_t i =0;i<a.aize();i++){ | ^~~~ | size a.cc:27:39: error: expected unqualified-id before '[' token 27 | printf("%d:%02d",a[i].first,a.[i].second); | ^
s753127391
p00293
C++
int main() { int n,m; vector<pair<int,int>> v;  //1つ目の時刻表 cin>>n; rep(i,0,n){ int h,m; cin>>h>>m; v.pb(make_pair(h,m)); } //2つ目の時刻表 cin>>m; rep(i,0,m){ int h,m; cin>>h>>m; v.pb(make_pair(h,m)); } Sort(v); //重複を消す v.erase(unique(v.begin(),v.end()),v.end()); //時間は普通に、分は0埋め2桁で出力。 rep(i,0,v.size()){ if(i)cout<<" "; printf("%d:%02d",v[i].fi,v[i].se); } cout<<endl; return 0; }
a.cc:4:1: error: extended character   is not valid in an identifier 4 |  //1つ目の時刻表 | ^ a.cc: In function 'int main()': a.cc:3:5: error: 'vector' was not declared in this scope 3 | vector<pair<int,int>> v; | ^~~~~~ a.cc:3:12: error: 'pair' was not declared in this scope 3 | vector<pair<int,int>> v; | ^~~~ a.cc:3:17: error: expected primary-expression before 'int' 3 | vector<pair<int,int>> v; | ^~~ a.cc:4:1: error: '\U00003000' was not declared in this scope 4 |  //1つ目の時刻表 | ^~ a.cc:6:9: error: 'i' was not declared in this scope 6 | rep(i,0,n){ | ^ a.cc:6:5: error: 'rep' was not declared in this scope 6 | rep(i,0,n){ | ^~~ a.cc:12:5: error: 'cin' was not declared in this scope 12 | cin>>m; | ^~~ a.cc:18:10: error: 'v' was not declared in this scope 18 | Sort(v); | ^ a.cc:18:5: error: 'Sort' was not declared in this scope 18 | Sort(v); | ^~~~ a.cc:20:13: error: 'unique' was not declared in this scope 20 | v.erase(unique(v.begin(),v.end()),v.end()); | ^~~~~~ a.cc:26:5: error: 'cout' was not declared in this scope 26 | cout<<endl; | ^~~~ a.cc:26:11: error: 'endl' was not declared in this scope 26 | cout<<endl; | ^~~~
s969777899
p00293
C++
#include <vector> int main() { int n,m; vector<pair<int,int>> v;  //1つ目の時刻表 cin>>n; rep(i,0,n){ int h,m; cin>>h>>m; v.pb(make_pair(h,m)); } //2つ目の時刻表 cin>>m; rep(i,0,m){ int h,m; cin>>h>>m; v.pb(make_pair(h,m)); } Sort(v); //重複を消す v.erase(unique(v.begin(),v.end()),v.end()); //時間は普通に、分は0埋め2桁で出力。 rep(i,0,v.size()){ if(i)cout<<" "; printf("%d:%02d",v[i].fi,v[i].se); } cout<<endl; return 0; }
a.cc:6:1: error: extended character   is not valid in an identifier 6 |  //1つ目の時刻表 | ^ a.cc: In function 'int main()': a.cc:5:5: error: 'vector' was not declared in this scope 5 | vector<pair<int,int>> v; | ^~~~~~ a.cc:5:5: note: suggested alternatives: In file included from /usr/include/c++/14/vector:66, from a.cc:1: /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:5:12: error: 'pair' was not declared in this scope; did you mean 'std::pair'? 5 | vector<pair<int,int>> v; | ^~~~ | std::pair In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/vector:62: /usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here 89 | struct pair; | ^~~~ a.cc:5:17: error: expected primary-expression before 'int' 5 | vector<pair<int,int>> v; | ^~~ a.cc:6:1: error: '\U00003000' was not declared in this scope 6 |  //1つ目の時刻表 | ^~ a.cc:8:9: error: 'i' was not declared in this scope 8 | rep(i,0,n){ | ^ a.cc:8:5: error: 'rep' was not declared in this scope 8 | rep(i,0,n){ | ^~~ a.cc:14:5: error: 'cin' was not declared in this scope 14 | cin>>m; | ^~~ a.cc:20:10: error: 'v' was not declared in this scope 20 | Sort(v); | ^ a.cc:20:5: error: 'Sort' was not declared in this scope 20 | Sort(v); | ^~~~ a.cc:22:13: error: 'unique' was not declared in this scope 22 | v.erase(unique(v.begin(),v.end()),v.end()); | ^~~~~~ a.cc:28:5: error: 'cout' was not declared in this scope 28 | cout<<endl; | ^~~~ a.cc:28:11: error: 'endl' was not declared in this scope 28 | cout<<endl; | ^~~~
s730378070
p00293
C++
include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <cmath> #include <cstring> #include <complex> using namespace std; //typedef typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long ll; #define omajinai ios::sync_with_stdio(false);cin.tie(0) //container util #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end()) #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i) #define RREP(i,n) RFOR(i,n,0) //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) //debug #define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n"; const int INF = 1e9; const double EPS = 1e-10; int n; int main() { vector<PII> v; REP(_,2){ cin >> n; REP(i,n){ int a, b; cin>>a>>b; v.push_back(MP(a,b)); } } SORT(v); UNIQUE(v); REP(i, v.size()){ cout << v[i].first << ":"; if(v[i].second<10)cout << 0; cout << v[i].second; if(i<v.size()-1)cout << " "; } cout << endl; }
a.cc:1:1: error: 'include' does not name a type 1 | include <vector> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/bits/stl_tree.h:63, from /usr/include/c++/14/map:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | stru
s136253350
p00293
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,m,c,d,a[10000],b[1440],cnt; cin>>n; for(int i=0;i<n;i++){ cin>>c>>d; b[c*60+d]=1; } cin>>m; for(int i =0;i<m;i++){ cin>>c>>d; b[c*60+d]=1; } for(int i=0;i<1440;i++){ if(b[i]==1){ if(cnt){cout<<' '; } cnt++; cout<<i/60<<':'; if(i%60<10){ cout<<'0'; } } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s801821235
p00293
C++
#include<iostream> #include<algorithm> using namespace std; int n,m,c,d,a[10000],b[1440],cnt; int main(){ cin>>n; for(int i=0;i<n;i++){ cin>>c>>d; b[c*60+d]=1; } cin>>m; for(int i =0;i<m;i++){ cin>>c>>d; b[c*60+d]=1; } for(int i=0;i<1440;i++){ if(b[i]==1){ if(cnt){cout<<' '; } cnt++; cout<<i/60<<':'; if(i%60<10){ cout<<'0'; } } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:31:2: error: expected '}' at end of input 31 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s101324959
p00293
C++
#include<iostream> #include<algorithm> using namespace std; int n,m,c,d,a[10000],b[1440],cnt; int main(){ cin>>n; for(int i=0;i<n;i++){ cin>>c>>d; b[c*60+d]=1; } cin>>m; for(int i =0;i<m;i++){ cin>>c>>d; b[c*60+d]=1; } for(int i=0;i<1440;i++){ if(b[i]==1){ if(cnt){cout<<' '; cnt++; cout<<i/60<<':'; if(i%60<10){ cout<<'0'; } } } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:31:2: error: expected '}' at end of input 31 | } | ^ a.cc:7:11: note: to match this '{' 7 | int main(){ | ^
s828764401
p00294
Java
import java.util.Arrays; import java.util.Scanner; public class main { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int N = stdIn.nextInt(); int M = stdIn.nextInt(); int p = stdIn.nextInt(); int d[] = new int[M]; for (int i = 0; i < M; i++) { int a = stdIn.nextInt(); d[i] = (a - p + N) % N; } Arrays.sort(d); int b = 0; if (N - d[0] < d[M - 1]) { b = N - d[0]; } else { b = d[M - 1]; } for (int i = 0; i < M; i++) { if (i > 0) { int a = 2 * (N - d[i]) + d[i - 1]; if (a < b) { b = a; } if (i < M - 1) { int c = 2 * d[i] + N - d[i + 1]; if (c < b) { b = c; } } } } System.out.println(b * 100); } }
Main.java:4: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s557478532
p00294
C
#include<stdio.h> void sort(void); int right(int); int left(int); int min(int,int); int N,M,p,cost=0; int *d; int right(int i) { return d[i] - cost; } int left(int i) { return N - d[i] + p; } int min(int x,int y) { if(x < y) return x; else return y; } void sort(void) { int i,j,T; for(i=0;i<M-1;i++){ for(j=i+1;j<M;j++){ if(d[i] > d[j]){ T = d[i]; d[i] = d[j]; d[j] = T; } } } } int main(void) { int i; scanf("%d %d %d",&N,&M,&p); d = new int[M]; for(i=0;i<M;i++) scanf("%d",&d[i]); sort(); for(i=0;i<M;i++) printf("%d ",d[i]); for(i=0;i<M;i++){ cost = cost + min(right(i),left(i)); } printf("%d\n",cost*100); }
main.c: In function 'main': main.c:45:13: error: 'new' undeclared (first use in this function) 45 | d = new int[M]; | ^~~ main.c:45:13: note: each undeclared identifier is reported only once for each function it appears in main.c:45:16: error: expected ';' before 'int' 45 | d = new int[M]; | ^~~~ | ;
s577912602
p00294
C
#include<cstdio> #include<algorithm> using namespace std; int n,m,p; int d[10001]; int dist(int i,int j){ if(i==j) return 0; else if(i<j) return j-i; else return j+n-i; } void solve(){ int ans=100000; for(int i=0;i<m;i++){ ans=min(ans,dist(p,d[i])+dist(d[i+1%m],d[i])); ans=min(ans,dist(d[i],p)+dist(d[i],d[(i+m-1)%m])); } printf("%d\n",ans*100); } int main(void){ scanf("%d%d%d",&n,&m,&p); d[0]=p; for(int i=1;i<=m;i++){ scanf("%d",&d[i]); } m++; sort(d,d+m); solve(); return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s048948613
p00294
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s421993196
p00294
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,j) for(int i=0;i<j;++i) int N,M,p,d[10010]; int main(){ cin>>N>>M>>p; rep(i,M){ scanf("%d",d+i); d[i]=(d[i]-p+N)%N; } sort(d,d+M); p=N; rep(i,M){ p=min(p,d[i]+min(d[M-1]-d[i],i==M-1?d[i]-d[0]:N+d[i]-d[i+1])); p=min(p,N-d[i]+min(d[i]-d[0],i==0?d[M-1]-d[i]:N+d[i-1]-d[i])); } cout<<p*100<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:17:16: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and 'const char [2]') 17 | cout<<p*100<"\n"; | ~~~~~~~~~~~^~~~~ | | | | | const char [2] | std::basic_ostream<char> In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:17:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:17:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [2]' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 17 | cout<<p*100<"\n"; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 17 | cout<<p*100<"\n"; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 17 | cout<<p*100<"\n"; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:17:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:17:17: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | cout<<p*100<"\n"; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basi
s985329206
p00294
C++
import java.sql.Array; import java.util.Arrays; import java.util.Scanner; public class Main { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); long start = System.currentTimeMillis(); long fin = System.currentTimeMillis(); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int N = sc.nextInt(); int M = sc.nextInt(); int p = sc.nextInt(); int sum = 0; boolean[] v = new boolean[N]; Arrays.fill(v, true); for (int i = 0; i < M; i++) { v[sc.nextInt()] = false; } for (int i = 0; i < M; i++) { int r = p; int l = p; int dis = 0; while (true) { if (!v[r]) { v[r] = true; p = r; break; } if (!v[l]) { v[l] = true; p = l; break; } r++; l--; if (l < 0) { l = N - 1; } if (r >= N) { r = 0; } dis++; } sum += dis; } System.out.println(sum * 100); } public static void main(String[] args) { new Main().run(); } void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } void debug2(char[][] array) { for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].length; j++) { System.out.print(array[i][j]); } System.out.println(); } } boolean inner(int h, int w, int limH, int limW) { return 0 <= h && h < limH && 0 <= w && w < limW; } void swap(int[] x, int a, int b) { int tmp = x[a]; x[a] = x[b]; x[b] = tmp; } // find minimum i (a[i] >= border) int lower_bound(int a[], int border) { int l = -1; int r = a.length; while (r - l > 1) { int mid = (l + r) / 2; if (border <= a[mid]) { r = mid; } else { l = mid; } } // r = l + 1 return r; } boolean palindrome(String s) { for (int i = 0; i < s.length() / 2; i++) { if (s.charAt(i) != s.charAt(s.length() - 1 - i)) { return false; } } return true; } class MyScanner { int nextInt() { try { int c = System.in.read(); while (c != '-' && (c < '0' || '9' < c)) c = System.in.read(); if (c == '-') return -nextInt(); int res = 0; do { res *= 10; res += c - '0'; c = System.in.read(); } while ('0' <= c && c <= '9'); return res; } catch (Exception e) { return -1; } } double nextDouble() { return Double.parseDouble(next()); } long nextLong() { return Long.parseLong(next()); } String next() { try { StringBuilder res = new StringBuilder(""); int c = System.in.read(); while (Character.isWhitespace(c)) c = System.in.read(); do { res.append((char) c); } while (!Character.isWhitespace(c = System.in.read())); return res.toString(); } catch (Exception e) { return null; } } int[] nextIntArray(int n) { int[] in = new int[n]; for (int i = 0; i < n; i++) { in[i] = nextInt(); } return in; } int[][] nextInt2dArray(int n, int m) { int[][] in = new int[n][m]; for (int i = 0; i < n; i++) { in[i] = nextIntArray(m); } return in; } double[] nextDoubleArray(int n) { double[] in = new double[n]; for (int i = 0; i < n; i++) { in[i] = nextDouble(); } return in; } long[] nextLongArray(int n) { long[] in = new long[n]; for (int i = 0; i < n; i++) { in[i] = nextLong(); } return in; } char[][] nextCharField(int n, int m) { char[][] in = new char[n][m]; for (int i = 0; i < n; i++) { String s = sc.next(); for (int j = 0; j < m; j++) { in[i][j] = s.charAt(j); } } return in; } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.sql.Array; | ^~~~~~ 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.Arrays; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.Scanner; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s580236332
p00294
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,m,p; cin>>n>>m>>p; vector<int> d(m); for(int i=0;i<m;i++){ cin>>d[i]; d[i]=(d[i]+n-p)%n; } sort(d.begin(),d.end()); for(int i=0;i<m;i++) d.push_back(d[i]); int ans=min(n-d[0],d[m-1]); for(int i=1;i+1<2*m;i++){ int tmp1=2*d[i]+n-d[i+1]; int tmp2=2*(n-d[i])+d[i-1]; ans=min(ans,min(tmp1,tmp2)); } cout<<ans*100<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:22: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>') 18 | cout<<ans*100<endl; | ~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:18:23: note: couldn't deduce template parameter '_Bi_iter' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:18:23: note: couldn't deduce template parameter '_Bi_iter' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | cout<<ans*100<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 18 | cout<<ans*100<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 18 | cout<<ans*100<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:18:23: note: couldn't deduce template parameter '_CharT' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:18:23: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 18 | cout<<ans*100<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 |
s961440616
p00294
C++
#include<stdio.h> int d[100000] = { 0 }; int main() { int n, m, p, i, v, j, c = 0, z = 0, k = 0, l; scanf_s("%d %d %d", &n, &m, &p); for (i = 0; i < m; i++) { scanf_s("%d", &v); d[v] = 1; } for (;;) { l = 0; z = 0; i = p; j = p; while(1){ if (i > n-1) { i = 0; } if (j < 0) { j = n-1; } if (d[i] == 1) { c += l; d[i] = 2; p = i; break; } if (d[j] == 1) { c += l; d[j] = 2; p = j; break; } if (i == p&&j == p&&z > 0) { break; } if (i == p&&z > 0) { i--; } if (j == p&&z > 0) { j++; } z++; i++; j--; l++; } k = 0; for (i = 0; i < n; i++) { if (d[i] == 1) { k = 1; } } if (k == 0) { break; } } printf("%d\n", c*100); return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 6 | scanf_s("%d %d %d", &n, &m, &p); | ^~~~~~~ | scanf
s065713216
p00294
C++
#include<bits/stdc++.h> using namespace std; int n,m,p,a[1<<17],i,r,V,W,X; main(){ cin>>n>>m>>p; for(i=0;i<m;i++){cin>>a[i];a[i]+=n-p;a[i]%=n;} sort(a,a+m); r=min(a[m-1],n-a[0]); for(int i=0;i<m-1;i++){ V=a[i],W=n-a[i+1];if(V>W)swap(V,W); X=2*V+W;r=min(ret,X); } cout<<r*100<<endl; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:11:15: error: 'ret' was not declared in this scope 11 | X=2*V+W;r=min(ret,X); | ^~~
s177327577
p00294
C++
#include <iostream> using namespace std; int main(){ int N,M,p; cin>>N>>M>>p; int d[10001]; d[0]=p; for(int i=0;i<M;i++) cin>>d[i]; sort(d,d+M+1); int c_min=N-1; for(int i=0;i<M+1;i++){ int q=d[i]; int r1=d[(i-1+M+1)%(M+1)]; int r2=d[(i+1)%(M+1)]; int c1=((p-q+N)%N)*2+(p-r1+N)%N; int c1=((q-p+N)%N)*2+(r2-p+N)%N; c_min=min(c_min,min(c1,c2)); } cout<<c_min*100<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(d,d+M+1); | ^~~~ | short a.cc:18:21: error: redeclaration of 'int c1' 18 | int c1=((q-p+N)%N)*2+(r2-p+N)%N; | ^~ a.cc:17:21: note: 'int c1' previously declared here 17 | int c1=((p-q+N)%N)*2+(p-r1+N)%N; | ^~ a.cc:19:40: error: 'c2' was not declared in this scope; did you mean 'c1'? 19 | c_min=min(c_min,min(c1,c2)); | ^~ | c1
s934131485
p00294
C++
#include<iostream> #include<algorithm> #include<deque> #include<queue> using namespace std; int main(){ int a; int n=0; int m=0; int p=0; int i=0; int g=0; int j=0; int w[2]; priority_queue<int,vector<int>,greater<int> > pq; deque<int> de; cin>>n>>m>>p; for(i=0;i<m;i++){ cin>>a; if(a<p)a+=n; a-=p; pq.push(a); } while(!pq.empty()){ de.push_back(pq.top()); pq.pop(); } for(i=0;i<m;i++){ w[0]=de.front()-p; w[1]=n+p-de.back(); if(w[0]>w[1]){ }
a.cc: In function 'int main()': a.cc:33:2: error: expected '}' at end of input 33 | } | ^ a.cc:28:25: note: to match this '{' 28 | for(i=0;i<m;i++){ | ^ a.cc:33:2: error: expected '}' at end of input 33 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s557243834
p00294
C++
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cctype> using namespace std; int main() { int N,M,p,D; int R=10000; cin>>N>>M>>p; for(int i=0;i<M;i++){ cin>>D; } int solve(){ if ( D.size() == 1 ) return min(pdist(D[0], p), ndist(D[0], p)); int ans= 2*N; for ( int i= 0; i< M; i++ ){ int b = D[i]; int e = D[(i+1)%M]; int d = min(pdist(b, p), min(pdist(e, p), min(ndist(b, p), ndist(e,p)))); ans= min(d + (N-pdist(b, e)), ans); } cout<<R<<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:18: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 23 | int solve(){ | ^~ a.cc:23:18: note: remove parentheses to default-initialize a variable 23 | int solve(){ | ^~ | -- a.cc:23:18: note: or replace parentheses with braces to value-initialize a variable a.cc:23:20: error: a function-definition is not allowed here before '{' token 23 | int solve(){ | ^ a.cc:39:2: error: expected '}' at end of input 39 | } | ^ a.cc:16:12: note: to match this '{' 16 | int main() { | ^
s608445720
p00294
C++
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cctype> using namespace std; int N, M, p; vector<int> D; int pdist(int s, int t){ return ( t >= s )?(t -s):((t+N) -s); } int ndist(int s, int t){ return pdist(t, s);} int solve(){ if ( D.size() == 1 ) return min(pdist(D[0], p), ndist(D[0], p)); int ans= 2*N; for ( int i= 0; i< M; i++ ){ int b = D[i]; int e = D[(i+1)%M]; int d = min(pdist(b, p), min(pdist(e, p), min(ndist(b, p), ndist(e,p)))); ans= min(d + (N-pdist(b, e)), ans); } return ans; int main() { int k; cin>> N >> M >> p; for ( inti= 0; i< M; i++ ){ cin>> k; D.push_back(k); } sort(D.begin(), D.end()); cout<< 100*solve() << endl; return 0; }
a.cc: In function 'int solve()': a.cc:31:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 31 | int main() { | ^~ a.cc:31:9: note: remove parentheses to default-initialize a variable 31 | int main() { | ^~ | -- a.cc:31:9: note: or replace parentheses with braces to value-initialize a variable a.cc:31:12: error: a function-definition is not allowed here before '{' token 31 | int main() { | ^ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:20:20: note: to match this '{' 20 | int solve(){ | ^
s912747511
p00294
C++
//============================================================================ // Name : AOJ.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cctype> using namespace std; int N, M, p; vector<int> D; int pdist(int s, int t){ return ( t >= s )?(t -s):((t+N) -s); } int ndist(int s, int t){ return pdist(t, s);} int solve(){ if ( D.size() == 1 ) return min(pdist(D[0], p), ndist(D[0], p)); int ans= 2*N; for ( int i= 0; i< M; i++ ){ int b = D[i]; int e = D[(i+1)%M]; int d = min(pdist(b, p), min(pdist(e, p), min(ndist(b, p), ndist(e,p)))); ans= min(d + (N-pdist(b, e)), ans); } return ans; } int main() { int k; cin>> N >> M >> p; for ( inti= 0; i< M; i++ ){ cin>> k; D.push_back(k); } sort(D.begin(), D.end()); cout<< 100*solve() << endl; return 0; }
a.cc: In function 'int main()': a.cc:35:15: error: 'inti' was not declared in this scope; did you mean 'int'? 35 | for ( inti= 0; i< M; i++ ){ | ^~~~ | int a.cc:35:24: error: 'i' was not declared in this scope 35 | for ( inti= 0; i< M; i++ ){ | ^
s218971215
p00294
C++
#include<iostream> using namespace std; int N, M, p
a.cc:3:12: error: expected initializer at end of input 3 | int N, M, p | ^
s507492283
p00294
C++
#include<iostream> using namespace std; int main(){ int N; cin>>N; int h[101],m[101]; for(int i=0;i<N;i++) cin>>h[i]>>m[i]; h[N]=24; m[N]=0; int M; cin>>M; int k[101],g[101]; for(int i=0;i<N;i++) cin>>k[i]>>g[i]; k[N]=24; g[N]=0; for(int i=0,j=0;i<N||j<M){ if(h[i]==k[j]&&m[i]==g[j]){ cout<<h[i]<<':'<<m[i]/10<<m[i]%10; i++; j++; } else if(h[i]<k[j]||(h[i]==k[j]&&m[i]<g[j])){ cout<<h[i]<<':'<<m[i]/10<<m[i]%10; i++; } else{ cout<<k[j]<<':'<<g[j]/10<<g[j]%10; j++; } if(i==N&&j==M) cout<endl; else cout<<' '; } return 0; }
a.cc: In function 'int main()': a.cc:21:33: error: expected ';' before ')' token 21 | for(int i=0,j=0;i<N||j<M){ | ^ | ; a.cc:36:29: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 36 | cout<endl; | ~~~~^~~~~ In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 36 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 36 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 36 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 36 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 36 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 36 | cout<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 36 | cout<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:36:30: note: couldn't deduce template parameter '_CharT' 36 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 36 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 36 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:36:30: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 36 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:36:30: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 36 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s097397283
p00294
C++
#include<iostream> #include<stack> #include<algorithm> using namespace std; int Route(int* D,int m,int start,int n) { int route; int min=n; int max=0; for(int i=0;i<m;i++){ if(D[i]<=n/2&&max<D[i]) max=D[i]; if(D[i]>n/2&&min>D[i]||start>D[i]&&D[i]!=n/2) min=D[i]; } int r=start; int l=start; int route1=0; int route2=0; stack<int> s1; s1.push(r); while(max!=start){ if(r+1==n){ r=0; s1.push(r); } else if(r!=n/2+1||start==n/2+1){ r++; s1.push(r); } else{ break; } if(s1.top()==max){ route1=s1.size()-1; break; } } stack<int> s2; s2.push(l); while(min!=n){ if(l-1==-1){ l=n-1; s2.push(l); } else if(l!=n/2){ l--; s2.push(l); } else{ break; } if(s2.top()==min){ route2=s2.size()-1; break; } } if(route1<=route2) route=2*route1+route2; else if(route1>route2) route=2*route2+route1; else if(route2==0) route=route1; else if(route1==0) route=route2; if(D[0]<=n/2&&D[m-1]>=n/2){ if(D[m-1]>=start){ if(D[m-1]-start<route) route=D[m-1]-start; } else{ if(start-D[0]<route) route=start-D[0]; } } return route; } int main(){ int N,M; cin>>N>>M; int p; cin>>p; int d[100000]; for(int i=0;i<M;i++) cin>>d[i]; sort(d,d+M); cout<<Route(d,M,p,N)*100<<endl; return 0;
a.cc: In function 'int main()': a.cc:101:14: error: expected '}' at end of input 101 | return 0; | ^ a.cc:86:11: note: to match this '{' 86 | int main(){ | ^
s331682660
p00294
C++
#include<iostream> using namespace std; int main(){ int N,M,p; cin>>N>>M>>p; int d[10001]; d[0]=p; for(int i=1;i<=M;i++){ cin>>d[i]; } sort(d,d+M+1); int c_min=N-1; for(int i=0;i<M+1;i++){ int q=d[i]; int r1=d[(i-1+M+1)%(M+1)]; int r2=d[(i+1)%(M+1)]; int c1=((p-q+N)*2+(r1-p+N)%N; int c2=((q-p+N)*2+(p-r2+N)%N; c_min=min(c_min,min(c1,c2)); } cout<<c_min*100<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(d,d+M+1); | ^~~~ | short a.cc:18:45: error: expected ')' before ';' token 18 | int c1=((p-q+N)*2+(r1-p+N)%N; | ~ ^ | ) a.cc:19:45: error: expected ')' before ';' token 19 | int c2=((q-p+N)*2+(p-r2+N)%N; | ~ ^ | )
s350645365
p00294
C++
#include <iostream> #include <algorithm> using namespace std; int int main() { int N,M,p; cin>>N>>M>>p; int d[10001]; d[0]=p; for (int i = 1; i < M; i++) { cin>>d[i]; } sort(d,d+M+1); int c_min =N-1; for (int i = 0; i < M+1; i++) { int q =d[i]; int r1 =d[(i-1+M+1)%(M+1)]; int r2 =d[(i+1)%(M+1)]; int c1 =((p-q+N)%N)*2+(r1-p+N)%N; int c2 =((p-q+N)%N)*2+(p-r2+N)%N; c_min =min(c_min,min(c1,c2)); } cout <<c_min*100 << endl; return 0; }
a.cc:5:1: error: two or more data types in declaration of 'main' 5 | int int main() { | ^~~
s712985070
p00294
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int N,M,p = 0; cin >> N >> M >> p; int d[M+1]; d[0] = p; for(int i=1; i<=M; i++){ cin >> d[i]; } sort(d, d+M+1); int money = N-1; for(int i=0; i<M+1; i++){ int q = d[i]; int r1 = d[(i-1+M+1)%(M+1)]; int r2 = d[(i+1)%(M+1)]; int c1 = ((p-q+N)%N)*2+(r1-p+N)%N; int c2 = ((q-p+N)%N)*2+(p-r2+N)%N; money = min(money, min(c1,c2)); } cout << money*100 << endl; return 0; } ~
a.cc:30:2: error: expected class-name at end of input 30 | ~ | ^
s242917154
p00294
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int N, M, p; cin >> M >> N >> p; int d[1001]; d[0] = p; for (int i = 1; i < M + 1; i++) cin > d[i]; sort(d, d + M + 1); int c_min = N - 1; for (int i = 0; i < M + 1; i++) { int q = d[i]; int r1 = d[(i - 1 + M + 1) % (M + 1)]; int r2 = d[(i + 1) % (M + 1)]; int c1 = ((p - q + N) % N) * 2 + (r1 - p + N) % N; int c2 = ((q - p + N) % N) * 2 + (p - r2 + N) % N; c_min = min(c_min, min(c1, c2)); } cout << c_min * 100 << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:21: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 14 | cin > d[i]; | ~~~ ^ ~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:14:21: note: candidate: 'operator>(int, int)' (built-in) 14 | cin > d[i]; | ~~~~^~~~~~ a.cc:14:21: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin > d[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 14 | cin > d[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin > d[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 14 | cin > d[i]; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 14 | cin > d[i]; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin > d[i]; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 14 | cin > d[i]; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:14:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 14 | cin > d[i]; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin > d[i]; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | cin > d[i]; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:14:26: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 14 | cin > d[i]; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:14:26: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 14 | cin > d[i]; | ^
s768667070
p00294
C++
#include<bits/stdc++.h> #define INF 10e8 using namespace std; int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; int main(void) { cin>>n>>m>>s; for(i=0;i<m;i++) cin>>d[i],flg[d[i]]=1; ans=x=0; for(i=s;i<n;i++) { if(flg[i]==1) { ll=i; break; } if(i+1==n) i=-1; } for(i=s;i>=0;i--) { if(flg[i]==1) { rr=i; break; } if(i-1<0) i=n; } for(i=s;i<n;i++) { if(rr==i) break; if(i+1==n) i=-1; ans++; } for(i=s;i>=0;i--) { if(ll==i) break; if(i-1<0) i=n; x++; } sort(d,d+m); for(i=0;i<m-1;i++) right[d[i]]=d[i+1]; right[d[m-1]]=d[0]; for(i=m-1;i>=1;i--) left[d[i]]=d[i-1]; left[d[0]]=d[m-1]; right[s]=rr,left[s]=ll; ans=min(ans,x); int ff,a,b,c; for(i=s;i<n;i++) { if(flg[i]==1&&right[s]!=i) { a=i-s; b=s-right[i]; if(a<0&&b>0) a+=n; else if(a>0&&b<0) b+=n; a*=2; ans=min(ans,a+b); } else if (d[m-1]==i) break; if(i+1==n) i=-1; } for(i=s;i>=0;i--) { if(flg[i]==1&&left[s]!=i){ a=s-i; b=left[i]-s; if(a<0&&b>0) a+=n; else if(a>0&&b<0) b+=n; a*=2; ans=min(ans,a+b); } else if (d[0]==i) break; if(i-1<0) i=n; } cout<<ans*100<<endl; }
a.cc: In function 'int main()': a.cc:37:28: error: reference to 'right' is ambiguous 37 | for(i=0;i<m-1;i++) right[d[i]]=d[i+1]; | ^~~~~ In file included from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54, from a.cc:1: /usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)' 1070 | right(ios_base& __base) | ^~~~~ a.cc:4:38: note: 'int right [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~~ a.cc:38:9: error: reference to 'right' is ambiguous 38 | right[d[m-1]]=d[0]; | ^~~~~ /usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)' 1070 | right(ios_base& __base) | ^~~~~ a.cc:4:38: note: 'int right [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~~ a.cc:39:29: error: reference to 'left' is ambiguous 39 | for(i=m-1;i>=1;i--) left[d[i]]=d[i-1]; | ^~~~ /usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)' 1062 | left(ios_base& __base) | ^~~~ a.cc:4:26: note: 'int left [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~ a.cc:40:9: error: reference to 'left' is ambiguous 40 | left[d[0]]=d[m-1]; | ^~~~ /usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)' 1062 | left(ios_base& __base) | ^~~~ a.cc:4:26: note: 'int left [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~ a.cc:41:9: error: reference to 'right' is ambiguous 41 | right[s]=rr,left[s]=ll; | ^~~~~ /usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)' 1070 | right(ios_base& __base) | ^~~~~ a.cc:4:38: note: 'int right [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~~ a.cc:41:21: error: reference to 'left' is ambiguous 41 | right[s]=rr,left[s]=ll; | ^~~~ /usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)' 1062 | left(ios_base& __base) | ^~~~ a.cc:4:26: note: 'int left [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~ a.cc:45:31: error: reference to 'right' is ambiguous 45 | if(flg[i]==1&&right[s]!=i) { | ^~~~~ /usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)' 1070 | right(ios_base& __base) | ^~~~~ a.cc:4:38: note: 'int right [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~~ a.cc:47:29: error: reference to 'right' is ambiguous 47 | b=s-right[i]; | ^~~~~ /usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)' 1070 | right(ios_base& __base) | ^~~~~ a.cc:4:38: note: 'int right [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~~ a.cc:57:31: error: reference to 'left' is ambiguous 57 | if(flg[i]==1&&left[s]!=i){ | ^~~~ /usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)' 1062 | left(ios_base& __base) | ^~~~ a.cc:4:26: note: 'int left [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~ a.cc:59:27: error: reference to 'left' is ambiguous 59 | b=left[i]-s; | ^~~~ /usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)' 1062 | left(ios_base& __base) | ^~~~ a.cc:4:26: note: 'int left [10000]' 4 | int i,j,k,n,m,d[10000],s,left[10000],right[10000],x,flg[100000]={0},ans,rr,ll; | ^~~~
s912895975
p00294
C++
#include<iostream> using namespace std; int main(void){ int i,j,n,m,p,a,b,e,f,g; cin>>n>>m>>p; e=p-0; int c[m],d[m]; int station[n],visit[m]; for(i=0;i<n;i++){ station[i]=i; } for(i=0;i<m;i++){ cin>>visit[i]; visit[i]-=e; } for(i=0;i<m;i++){ for(j=0;j<m;j++){ if(visit[i]>visit[j]){ int swap=visit[i]; visit[i]=visit[j]; visit[j]=swap; } } } a=visit[m-1]; b=n-a+1; for(i=0;i<m-1;i++){ c[i]=visit[i]*2+n-visit[i+1]+1; d[i]=visit[i]+2*(n-visit[i+1]+1); } for(i=0;i<m-1;i++){ for(j=0;j<m;j++){ if(c[i]>c[j]){ swap=c[i]; c[i]=c[j]; c[j]=swap; } if(d[i]>d[j]){ swap=d[i]; d[i]=d[j]; d[j]=swap; } } } f=c[0]; g=d[0]; if(a>b){ a=b; } if(a>c){ a=c; } if(a>d){ a=d; } cout>>a>>endl; return 0; }
a.cc: In function 'int main()': a.cc:34:25: error: overloaded function with no contextual type information 34 | swap=c[i]; | ^ a.cc:36:22: error: cannot resolve overloaded function 'swap' based on conversion to type 'int' 36 | c[j]=swap; | ^~~~ a.cc:39:25: error: overloaded function with no contextual type information 39 | swap=d[i]; | ^ a.cc:41:22: error: cannot resolve overloaded function 'swap' based on conversion to type 'int' 41 | d[j]=swap; | ^~~~ a.cc:50:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 50 | if(a>c){ | ~^~ a.cc:51:11: error: invalid conversion from 'int*' to 'int' [-fpermissive] 51 | a=c; | ^ | | | int* a.cc:53:9: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 53 | if(a>d){ | ~^~ a.cc:54:11: error: invalid conversion from 'int*' to 'int' [-fpermissive] 54 | a=d; | ^ | | | int* a.cc:56:9: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 56 | cout>>a>>endl; | ~~~~^~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:56:9: note: candidate: 'operator>>(int, int)' (built-in) 56 | cout>>a>>endl; | ~~~~^~~ a.cc:56:9: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:56:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 56 | cout>>a>>endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:56:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 56 | cout>>a>>endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:56:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 56 | cout>>a>>endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:56:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 56 | cout>>a>>endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:56:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 56 | cout>>a>>endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:56:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 56 | cout>>a>>endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:56:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 56 | cout>>a>>endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:56:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 56 | cout>>a>>endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:56:11: required from here 56 | cout>>a>>endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s253436430
p00294
C++
#include<iostream> #include<algorithm> using namespace std; int n, m, p ; int d[10010]; int main(){ cin >> n >> m >> p; for (int i = 0; i < m; i++) { cin >> d[i]; d[i] -= p; if (d[i] < 0)d[i] += n; } sort(&d[0], &d[m]); int ans = 0; ans=d[m - 1] * 100; ans = min(ans, (n - d[0]) * 100); ) for (int i = 0; i < M - 1; i++){ int c1 = 2 * (d[i] * 100); int c2 = (N - d[i + 1]) * 100; ans = min(ans, c1 + c2); } for (int i = M - 1; i > 0; i--){ int c1 = 2 * ((N - d[i]) * 100); int c2 = d[i - 1] * 100; ans = min(ans, c1 + c2); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:294: error: expected primary-expression before ')' token 19 | ans = min(ans, (n - d[0]) * 100); ) | ^ a.cc:20:25: error: 'i' was not declared in this scope 20 | for (int i = 0; i < M - 1; i++){ | ^ a.cc:20:29: error: 'M' was not declared in this scope 20 | for (int i = 0; i < M - 1; i++){ | ^ a.cc:26:32: error: 'N' was not declared in this scope 26 | int c1 = 2 * ((N - d[i]) * 100); | ^
s953497501
p00294
C++
#include<iostream> #include<algorithm> using namespace std; int n, m, p ; int d[10010]; int main(){ cin >> n >> m >> p; for (int i = 0; i < m; i++) { cin >> d[i]; d[i] -= p; if (d[i] < 0)d[i] += n; } sort(&d[0], &d[m]); int ans = 0; ans=d[m - 1] * 100; ans = min(ans, (n - d[0]) * 100); for (int i = 0; i < M - 1; i++){ int c1 = 2 * (d[i] * 100); int c2 = (N - d[i + 1]) * 100; ans = min(ans, c1 + c2); } for (int i = M - 1; i > 0; i--){ int c1 = 2 * ((N - d[i]) * 100); int c2 = d[i - 1] * 100; ans = min(ans, c1 + c2); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:29: error: 'M' was not declared in this scope 20 | for (int i = 0; i < M - 1; i++){ | ^ a.cc:22:27: error: 'N' was not declared in this scope 22 | int c2 = (N - d[i + 1]) * 100; | ^ a.cc:25:22: error: 'M' was not declared in this scope 25 | for (int i = M - 1; i > 0; i--){ | ^ a.cc:26:32: error: 'N' was not declared in this scope 26 | int c1 = 2 * ((N - d[i]) * 100); | ^
s525382912
p00294
C++
#include<bits/stdc++.h> using namespace std; int main(void){ int i,j,k,d[100005],n,m,s; cin>>n>>m>>s; for(i=0;i<m;i++)cin>>d[i]; d[m]=s; int ans,left,right; ans = 21000000; sort(d,d+m+1)=d[0]; for(i=0;i<=m;i++){ left = d[i]-s; if(left<0)left +=n; right = s-d[i+1]; if(right<0)right+=n; ans = min(ans,right*2 + left); ans= min(ans,left*2 + right); } cout<<ans*100<<endl; }
a.cc: In function 'int main()': a.cc:11:9: error: invalid use of 'void' 11 | sort(d,d+m+1)=d[0]; | ~~~~^~~~~~~~~
s422079552
p00294
C++
#include<bits/stdc++.h> using namespace std; int main(void){ int i,j,k,d[100005],n,m,s; cin>>n>>m>>s; for(i=0;i<m;i++)cin>>d[i]; d[m]=s; int ans,left,right; ans = 21000000; sort(d,d+m+1)=d[0]; for(i=0;i<=m;i++){ left = d[i]-s; if(left<0)left +=n; right = s-d[i+1]; if(right<0)right+=n; ans = min(ans,right*2 + left); ans= min(ans,left*2 + right); } cout<<ans*100<<endl; }
a.cc: In function 'int main()': a.cc:11:9: error: invalid use of 'void' 11 | sort(d,d+m+1)=d[0]; | ~~~~^~~~~~~~~
s531515134
p00295
C++
#include<cstdio> #include<vector> using namespace std; const int b[7] = {0,9,12,15,18,21,30}; inline bool check(const vector<int> &c){ for(int x=0;x<6;x++){ for(int i=b[x];i<b[x+1]-1;i++)if(c[i]!=c[i+1])return false; } return true; } inline void rot(vector<int> &c, int d){ if(d == 0){ swap(c[0],c[23]); swap(c[3],c[26]); swap(c[6],c[29]); swap(c[15],c[17]); swap(c[9],c[20]); } if(d == 1){ swap(c[6],c[21]); swap(c[7],c[22]); swap(c[8],c[23]); swap(c[9],c[11]); swap(c[12],c[17]); } if(d == 2){ swap(c[2],c[21]); swap(c[5],c[24]); swap(c[8],c[27]); swap(c[12],c[14]); swap(c[11],c[18]); } if(d == 3){ swap(c[0],c[27]); swap(c[1],c[28]); swap(c[2],c[29]); swap(c[18],c[20]); swap(c[14],c[15]); } } int rec(int d, vector<int> &c){ if(check(c))return d; if(d>=8)return 8; int res = 8; for(int i=0;i<4;i++){ rot(c,i); res = min(res, rec(d+1,c)); if(res==d)break; rot(c,i); } return res; } int main(){ int t; scanf("%d",&t); while(t--){ vector<int> p(30); for(int i=0;i<30;i++)scanf("%d\n",&p[i]); cout << rec(0,p) << endl; } }
a.cc: In function 'int main()': a.cc:52:5: error: 'cout' was not declared in this scope 52 | cout << rec(0,p) << endl; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<vector> +++ |+#include <iostream> 3 | using namespace std; a.cc:52:25: error: 'endl' was not declared in this scope 52 | cout << rec(0,p) << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include<vector> +++ |+#include <ostream> 3 | using namespace std;
s438331869
p00295
C++
#include <iostream> bool is_complete(int*); int solve(int *, int); void rot(int*, int); int min(int, int, int, int); void swap(int&, int&); int main(){ int N; int **p; std::cin >> N; p = new int*[N]; for(int i=0; i<N; i++){ p[i] = new int[30]; for(int j=0; j<30; j++) std::cin >> p[i][j]; } for(int i=0; i<N; i++) std::cout << min(rot(p[i], 1, 0), rot(p[i], 2, 0), rot(p[i], 3, 0), rot(p[i], 4, 0)) << std::endl; } bool is_complete(int* p){ int cmp=p[0]; for(int i=0; i<30; i++){ if(i == 9) cmp = p[9]; else if(i == 12) cmp = p[12]; else if(i == 15) cmp = p[15]; else if(i == 18) cmp = p[18]; else if(i == 21) cmp = p[21]; else if(cmp != p[i]) return false; } return true; } int solve(int *p, int cnt){ if(cnt == 9 || is_complete(p)) return cnt; int **pp = new int*[4]; for(int i=0; i<4; i++){ pp[i] = new int[30]; for(int j=0; j<30; j++) pp[i][j] = p[j]; } delete[] p; for(int dir=1; dir<=4; dir++){ rot(pp[dir-1], dir); if(is_complete(pp)) return cnt; } } void rot(int* p, int dir){ if(dir == 1){ swap(p[6], p[21]); swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[11]); swap(p[12], p[17]); }else if(dir == 2){ swap(p[0], p[27]); swap(p[1], p[28]); swap(p[2], p[29]); swap(p[18], p[20]); swap(p[14], p[15]); }else if(dir == 3){ swap(p[0], p[23]); swap(p[3], p[26]); swap(p[6], p[29]); swap(p[15], p[17]); swap(p[9], p[20]); }else{ swap(p[2], p[21]); swap(p[5], p[24]); swap(p[8], p[27]); swap(p[12], p[14]); swap(p[11], p[18]); } } int min(int a, int b, int c, int d){ int ans = a; if(ans > b) ans = b; if(ans > c) ans = c; if(ans > d) ans = d; return ans; } void swap(int& a, int& b){ int tmp = a; a = b; b = tmp; }
a.cc: In function 'int main()': a.cc:22:37: error: too many arguments to function 'void rot(int*, int)' 22 | std::cout << min(rot(p[i], 1, 0), rot(p[i], 2, 0), rot(p[i], 3, 0), rot(p[i], 4, 0)) << std::endl; | ~~~^~~~~~~~~~~~ a.cc:6:6: note: declared here 6 | void rot(int*, int); | ^~~ a.cc:22:54: error: too many arguments to function 'void rot(int*, int)' 22 | std::cout << min(rot(p[i], 1, 0), rot(p[i], 2, 0), rot(p[i], 3, 0), rot(p[i], 4, 0)) << std::endl; | ~~~^~~~~~~~~~~~ a.cc:6:6: note: declared here 6 | void rot(int*, int); | ^~~ a.cc:22:71: error: too many arguments to function 'void rot(int*, int)' 22 | std::cout << min(rot(p[i], 1, 0), rot(p[i], 2, 0), rot(p[i], 3, 0), rot(p[i], 4, 0)) << std::endl; | ~~~^~~~~~~~~~~~ a.cc:6:6: note: declared here 6 | void rot(int*, int); | ^~~ a.cc:22:88: error: too many arguments to function 'void rot(int*, int)' 22 | std::cout << min(rot(p[i], 1, 0), rot(p[i], 2, 0), rot(p[i], 3, 0), rot(p[i], 4, 0)) << std::endl; | ~~~^~~~~~~~~~~~ a.cc:6:6: note: declared here 6 | void rot(int*, int); | ^~~ a.cc:22:37: error: invalid use of void expression 22 | std::cout << min(rot(p[i], 1, 0), rot(p[i], 2, 0), rot(p[i], 3, 0), rot(p[i], 4, 0)) << std::endl; | ~~~^~~~~~~~~~~~ a.cc: In function 'int solve(int*, int)': a.cc:56:32: error: cannot convert 'int**' to 'int*' 56 | if(is_complete(pp)) | ^~ | | | int** a.cc:25:23: note: initializing argument 1 of 'bool is_complete(int*)' 25 | bool is_complete(int* p){ | ~~~~~^ a.cc:59:1: warning: control reaches end of non-void function [-Wreturn-type] 59 | } | ^
s389504224
p00295
C++
#include <iostream> bool is_complete(int*); int solve(int *, int); void rot(int*, int); int min(int, int, int, int); void swap(int&, int&); int main(){ int N; int **p; std::cin >> N; p = new int*[N]; for(int i=0; i<N; i++){ p[i] = new int[30]; for(int j=0; j<30; j++) std::cin >> p[i][j]; } for(int i=0; i<N; i++) std::cout << solve(p[i]) << std::endl; } bool is_complete(int* p){ int cmp=p[0]; for(int i=0; i<30; i++){ if(i == 9) cmp = p[9]; else if(i == 12) cmp = p[12]; else if(i == 15) cmp = p[15]; else if(i == 18) cmp = p[18]; else if(i == 21) cmp = p[21]; else if(cmp != p[i]) return false; } return true; } int solve(int *p, int cnt){ if(cnt == 9 || is_complete(p)) return cnt; int **pp = new int*[4]; for(int i=0; i<4; i++){ pp[i] = new int[30]; for(int j=0; j<30; j++) pp[i][j] = p[j]; } delete[] p; for(int dir=1; dir<=4; dir++){ rot(pp[dir-1], dir); if(is_complete(pp)) return cnt; } return min(sovle(pp[0]), solve(pp[1]), solve(pp[2]), solve(pp[3])); } void rot(int* p, int dir){ if(dir == 1){ swap(p[6], p[21]); swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[11]); swap(p[12], p[17]); }else if(dir == 2){ swap(p[0], p[27]); swap(p[1], p[28]); swap(p[2], p[29]); swap(p[18], p[20]); swap(p[14], p[15]); }else if(dir == 3){ swap(p[0], p[23]); swap(p[3], p[26]); swap(p[6], p[29]); swap(p[15], p[17]); swap(p[9], p[20]); }else{ swap(p[2], p[21]); swap(p[5], p[24]); swap(p[8], p[27]); swap(p[12], p[14]); swap(p[11], p[18]); } } int min(int a, int b, int c, int d){ int ans = a; if(ans > b) ans = b; if(ans > c) ans = c; if(ans > d) ans = d; return ans; } void swap(int& a, int& b){ int tmp = a; a = b; b = tmp; }
a.cc: In function 'int main()': a.cc:22:35: error: too few arguments to function 'int solve(int*, int)' 22 | std::cout << solve(p[i]) << std::endl; | ~~~~~^~~~~~ a.cc:5:5: note: declared here 5 | int solve(int *, int); | ^~~~~ a.cc: In function 'int solve(int*, int)': a.cc:56:32: error: cannot convert 'int**' to 'int*' 56 | if(is_complete(pp)) | ^~ | | | int** a.cc:25:23: note: initializing argument 1 of 'bool is_complete(int*)' 25 | bool is_complete(int* p){ | ~~~~~^ a.cc:59:20: error: 'sovle' was not declared in this scope; did you mean 'solve'? 59 | return min(sovle(pp[0]), solve(pp[1]), solve(pp[2]), solve(pp[3])); | ^~~~~ | solve a.cc:59:39: error: too few arguments to function 'int solve(int*, int)' 59 | return min(sovle(pp[0]), solve(pp[1]), solve(pp[2]), solve(pp[3])); | ~~~~~^~~~~~~ a.cc:44:5: note: declared here 44 | int solve(int *p, int cnt){ | ^~~~~ a.cc:59:53: error: too few arguments to function 'int solve(int*, int)' 59 | return min(sovle(pp[0]), solve(pp[1]), solve(pp[2]), solve(pp[3])); | ~~~~~^~~~~~~ a.cc:44:5: note: declared here 44 | int solve(int *p, int cnt){ | ^~~~~ a.cc:59:67: error: too few arguments to function 'int solve(int*, int)' 59 | return min(sovle(pp[0]), solve(pp[1]), solve(pp[2]), solve(pp[3])); | ~~~~~^~~~~~~ a.cc:44:5: note: declared here 44 | int solve(int *p, int cnt){ | ^~~~~
s787989827
p00295
C++
#include<cmath> #include<algorithm> #include<string> #include<vector> #include<map> using namespace std; //aからbに向かう,true=右回りfalse=左回り int get(int a,int b,int n,bool f){ if(f){ if(a>b)return b+n-a; else return b-a; } else{ if(a>b)return a-b; else return a+n-b; } } int main(){ int n,m,p,t[120000],ans; int a=0,b=0; cin>>n>>m>>p; ans=n; for(int i=0;i<m;i++)cin>>t[i]; sort(t,t+m); for(int i=0;i<m;i++){ a=max(a,get(p,t[i],n,1)); } for(int i=0;i<m;i++){ b=max(b,get(p,t[i],n,0)); } if(a<b)ans=a; else ans=b; for(int i=0;i<m;i++){ ans=min(ans,get(p,t[i],n,true)*2+get(p,t[i+1],n,0)); if(i==m-1)ans=min(ans,get(p,t[i],n,1)*2+get(p,t[0],n,0)); } for(int i=m-1;i>=0;i--){ if(i!=0)ans=min(ans,get(p,t[i],n,0)*2+get(p,t[i-1],n,1)); else ans=min(ans,get(p,t[i],n,0)*2+get(p,t[m-1],n,1)); } if(m==1)cout<<min(get(p,t[0],n,1),get(p,t[0],n,0))*100<<endl; else cout<<ans*100<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: 'cin' was not declared in this scope 21 | cin>>n>>m>>p; | ^~~ a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 5 | #include<map> +++ |+#include <iostream> 6 | using namespace std; a.cc:44:13: error: 'cout' was not declared in this scope 44 | if(m==1)cout<<min(get(p,t[0],n,1),get(p,t[0],n,0))*100<<endl; | ^~~~ a.cc:44:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:44:61: error: 'endl' was not declared in this scope 44 | if(m==1)cout<<min(get(p,t[0],n,1),get(p,t[0],n,0))*100<<endl; | ^~~~ a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 5 | #include<map> +++ |+#include <ostream> 6 | using namespace std; a.cc:45:10: error: 'cout' was not declared in this scope 45 | else cout<<ans*100<<endl; | ^~~~ a.cc:45:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:45:25: error: 'endl' was not declared in this scope 45 | else cout<<ans*100<<endl; | ^~~~ a.cc:45:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s086844476
p00295
C++
??£??£??£???
a.cc:1:3: error: extended character £ is not valid in an identifier 1 | ??£??£??£??? | ^ a.cc:1:6: error: extended character £ is not valid in an identifier 1 | ??£??£??£??? | ^ a.cc:1:9: error: extended character £ is not valid in an identifier 1 | ??£??£??£??? | ^ a.cc:1:1: error: expected unqualified-id before '?' token 1 | ??£??£??£??? | ^
s828318818
p00295
C++
#include <iostream> using namespace std; static int p_index[4][5] = { {15, 0, 3, 6, 9}, {18, 2, 1, 0, 15}, {12, 8, 5, 2, 18}, {9, 6, 7, 8, 12} }; static int n_index[4][5] = { {17, 23, 26, 29, 20}, {20, 29, 28, 27, 14}, {14, 27, 24, 21, 11}, {11, 21, 22, 23, 17} }; bool complete(int floppy_cube[]) { for (int i = 1; i < 9; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 10; i < 12; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 13; i < 15; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 16; i < 18; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 19; i < 21; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 22; i < 30; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } return true; } void rotate(int floppy_cube[30], int direction) { for (int i = 0; i < 5; i++) { swap(floppy_cube[p_index[direction][i]], floppy_cube[n_index[direction][i]]); } } int dfs(int floppy_cube[30], int depth = 0) { if (depth > 8) { return INT_MAX; } if (complete(floppy_cube)) { return depth; } int res = INT_MAX; int clone[30]; memcpy(clone, floppy_cube, sizeof(int) * 30); for (int i = 0; i < 5; i++) { rotate(floppy_cube, i); res = min(res, dfs(floppy_cube, depth + 1)); memcpy(floppy_cube, clone, sizeof(int) * 30); } return res; } int main() { int n; cin >> n; while (n--) { int floppy_cube[30]; for (int i = 0; i < 30; i++) { cin >> floppy_cube[i]; } cout << dfs(floppy_cube) << endl; } return 0; }
a.cc: In function 'int dfs(int*, int)': a.cc:66:16: error: 'INT_MAX' was not declared in this scope 66 | return INT_MAX; | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 | a.cc:72:15: error: 'INT_MAX' was not declared in this scope 72 | int res = INT_MAX; | ^~~~~~~ a.cc:72:15: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' a.cc:75:5: error: 'memcpy' was not declared in this scope 75 | memcpy(clone, floppy_cube, sizeof(int) * 30); | ^~~~~~ a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 |
s502143246
p00295
C++
#define INF 1000000000; #include <iostream> using namespace std; static int p_index[4][5] = { {15, 0, 3, 6, 9}, {18, 2, 1, 0, 15}, {12, 8, 5, 2, 18}, {9, 6, 7, 8, 12} }; static int n_index[4][5] = { {17, 23, 26, 29, 20}, {20, 29, 28, 27, 14}, {14, 27, 24, 21, 11}, {11, 21, 22, 23, 17} }; bool complete(int floppy_cube[]) { for (int i = 1; i < 9; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 10; i < 12; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 13; i < 15; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 16; i < 18; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 19; i < 21; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } for (int i = 22; i < 30; i++) { if (floppy_cube[i - 1] != floppy_cube[i]) { return false; } } return true; } void rotate(int floppy_cube[30], int direction) { for (int i = 0; i < 5; i++) { swap(floppy_cube[p_index[direction][i]], floppy_cube[n_index[direction][i]]); } } int dfs(int floppy_cube[30], int depth = 0) { if (depth > 8) { return INF; } if (complete(floppy_cube)) { return depth; } int res = INF; int clone[30]; memcpy(clone, floppy_cube, sizeof(int) * 30); for (int i = 0; i < 5; i++) { rotate(floppy_cube, i); res = min(res, dfs(floppy_cube, depth + 1)); memcpy(floppy_cube, clone, sizeof(int) * 30); } return res; } int main() { int n; cin >> n; while (n--) { int floppy_cube[30]; for (int i = 0; i < 30; i++) { cin >> floppy_cube[i]; } cout << dfs(floppy_cube) << endl; } return 0; }
a.cc: In function 'int dfs(int*, int)': a.cc:77:5: error: 'memcpy' was not declared in this scope 77 | memcpy(clone, floppy_cube, sizeof(int) * 30); | ^~~~~~ a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <iostream> +++ |+#include <cstring> 4 |
s506739982
p00295
C++
#include <iostream> #include <algorithm> using namespace std; void solve(); bool hantei(int *m,int s,int e) int main(){ int n; while(n--) solve(); return 0; } void solve(){ int i,j,tmp; int men[30],m[30]; int ans=8; for(i=0;i<30;i++) cin>>men[30]; for(i=0;i<65536;i++){ for(j=0;j<30;j++) m[j]=men[j]; tmp=i; for(j=1;j<=8;j++){ switch(tmp%4){ case 0: swap(m[0],m[27]);swap(m[1],m[28]);swap(m[2],m[29]); swap(m[14],m[15]);swap(m[18],m[20]); break; case 1: swap(m[6],m[21]);swap(m[7],m[22]);swap(m[8],m[23]); swap(m[12],m[17]);swap(m[9],m[11]); break; case 2: swap(m[2],m[21]);swap(m[5],m[24]);swap(m[8],m[27]); swap(m[11],m[18]);swap(m[12],m[14]); break; case 3: swap(m[0],m[23]);swap(m[3],m[26]);swap(m[6],m[29]); swap(m[9],m[20]);swap(m[15],m[17]); break; } tmp/=4; if(hantei(m,0,8) && hantei(m,9,11) && hantei(m,12,14) && hantei(m,15,17) && hantei(m,18,20) && hantei(m,21,29)) ans=min(ans,j); } } cout<<ans<<endl; } bool hantei(int *m,int s,int e){ int i; for(i=s+1;i<=e;i++){ if(m[i]!=m[s]) return false; } return true; }
a.cc:8:1: error: expected initializer before 'int' 8 | int main(){ | ^~~ a.cc: In function 'void solve()': a.cc:46:28: error: 'hantei' was not declared in this scope 46 | if(hantei(m,0,8) && hantei(m,9,11) && hantei(m,12,14) && hantei(m,15,17) && hantei(m,18,20) && hantei(m,21,29)) | ^~~~~~
s339206933
p00295
C++
#include<iostream> #include<queue> #include<vector> using namespace std; //queue?????\??£???????????????????????????pop?????????,??´??¢????????¢????????? queue<std::vector<int> > cubes; vector<int> puzzle; vector<int> tmppuzzle; namespace my{ int top,left,right,up,down,back; } void clear(){ for(int i=0;i<32;i++){ tmppuzzle[i] = puzzle[i]; } } int BFS(){ while(!cubes.empty()){ cubes.pop(); } bool flag = true; puzzle[30] = puzzle[31] = 0; cubes.push(puzzle); while(1){ flag = true; puzzle = cubes.front(); cubes.pop(); if(puzzle[30] == 8){ return 8; } my::top = puzzle[0]; my::left = puzzle[15]; my::right = puzzle[12]; my::up = puzzle[18]; my::down = puzzle[9]; my::back = puzzle[21]; if(flag){ for(int i=1;i<9;i++) if(my::top != puzzle[i]){ flag = false; break; } } if(flag){ for(int i=16;i<18;i++){ if(my::left != puzzle[i]){ flag = false; break; } } } if(flag){ for(int i=13;i<15;i++){ if(my::right != puzzle[i]){ flag = false; break; } } } if(flag){ for(int i=19;i<21;i++){ if(my::up != puzzle[i]){ flag = false; break; } } } if(flag){ for(int i=9;i<12;i++){ if(my::down != puzzle[i]){ flag = false; break; } } } if(flag){ for(int i=22;i<30;i++){ if(my::back != puzzle[i]){ flag = false; break; } } } if(flag){ return puzzle[30]; } puzzle[30] += 1; if(tmppuzzle[31] != 1){ clear(); swap(tmppuzzle[17],tmppuzzle[12]); swap(tmppuzzle[7],tmppuzzle[22]); swap(tmppuzzle[6],tmppuzzle[21]); swap(tmppuzzle[8],tmppuzzle[23]); swap(tmppuzzle[9],tmppuzzle[11]);//??´??¢ tmppuzzle[31] = 1; cubes.push(tmppuzzle); } if(tmppuzzle[31] != 2){ clear(); swap(tmppuzzle[0],tmppuzzle[27]); swap(tmppuzzle[1],tmppuzzle[28]); swap(tmppuzzle[2],tmppuzzle[29]); swap(tmppuzzle[14],tmppuzzle[15]); swap(tmppuzzle[18],tmppuzzle[20]);//??´??¢ tmppuzzle[31] = 2; cubes.push(tmppuzzle); } if(tmppuzzle[31] != 3){ clear(); swap(tmppuzzle[0],tmppuzzle[23]); swap(tmppuzzle[3],tmppuzzle[26]); swap(tmppuzzle[6],tmppuzzle[29]); swap(tmppuzzle[9],tmppuzzle[20]); swap(tmppuzzle[15],tmppuzzle[17]);//??´??¢ tmppuzzle[31] = 3; cubes.push(tmppuzzle); } if(tmppuzzle[31] != 4){ clear(); swap(tmppuzzle[2],tmppuzzle[21]); swap(tmppuzzle[5],tmppuzzle[24]); swap(tmppuzzle[8],tmppuzzle[27]); swap(tmppuzzle[11],tmppuzzle[18]); swap(tmppuzzle[12],tmppuzzle[14]);//??´??¢ tmppuzzle[31] = 4; cubes.push(tmppuzzle); } return -1; } int main(){ int n; cin >> n; puzzle.resize(32); tmppuzzle.resize(32); for(int i=0;i<n;i++){ for(int i=0;i<30;i++){ cin >> puzzle[i]; } cout << BFS() << endl; } return 0; }
a.cc: In function 'int BFS()': a.cc:151:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 151 | int main(){ | ^~ a.cc:151:9: note: remove parentheses to default-initialize a variable 151 | int main(){ | ^~ | -- a.cc:151:9: note: or replace parentheses with braces to value-initialize a variable a.cc:151:11: error: a function-definition is not allowed here before '{' token 151 | int main(){ | ^ a.cc:167:2: error: expected '}' at end of input 167 | } | ^ a.cc:19:11: note: to match this '{' 19 | int BFS(){ | ^
s253417863
p00295
C++
#include <iostream> #include <utility> #include <cmath> using namespace std; bool check(int* cube){ for(int i = 1; i < 9; i++){ if(cube[i] != cube[0]){ return false; } } for(int i = 10; i < 12; i++){ if(cube[i] != cube[9] || cube[i + 3] != cube[12]){ return false; } } return true; } void turn(int* cube, int i){ switch(i){ case 0: for(int i = 0; i <= 6; i += 3){ swap(cube[i], cube[23 + i]); } swap(cube[20], cube[9]); swap(cube[15], cube[17]); break; case 1: for(int i = 0; i < 3; i++){ swap(cube[i], cube[27 + i]); } swap(cube[14], cube[15]); swap(cube[20], cube[18]); break; case 2: for(int i = 2; i <= 8; i += 3){ swap(cube[i], cube[19 + i]); } swap(cube[18], cube[11]); swap(cube[14], cube[12]); break; case 3: for(int i = 6; i <= 8; i++){ swap(cube[i], cube[15 + i]); } swap(cube[17], cube[12]); swap(cube[9], cube[11]); break; default:break; } } int minimumTurn = 9; void calc(int* cube, int currentTurnCount, int prevTurn){ currentTurnCount++; if(currentTurnCount >= minimumTurn){ return; } for(int i = 0; i < 4; i++){ if(i == prevTurn){ continue; } int tempCube[30]; for(int j = 0; j < 30; j++){ tempCube[j] = cube[j]; } turn(cube, i); if(check(cube)){ minimumTurn = min(minimumTurn, currentTurnCount); return; } calc(cube, currentTurnCount, i); for(int j = 0; j < 30; j++){ cube[j] = tempCube[j]; } } } int main(){ //n???cin??§??¨??? int n = 1; cin << n; for(int k = 0; k < n; k++){ int cube[30]; for(int i = 0; i < 30; i++){ cin >> cube[i]; } minimumTurn = 9; if(!check(cube)){ calc(cube, 0, -1); }else{ minimumTurn = 0; } cout << minimumTurn << endl; } return 0; }
a.cc: In function 'int main()': a.cc:86:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 86 | cin << n; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:86:9: note: candidate: 'operator<<(int, int)' (built-in) 86 | cin << n; | ~~~~^~~~ a.cc:86:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, 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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:86:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 86 | cin << n; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:86:12: required from here 86 | cin << n; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~
s680115571
p00295
C++
#include <iostream> #include <utility> #include <cmath> using namespace std; bool check(int* cube){ for(int i = 1; i < 9; i++){ if(cube[i] != cube[0]){ return false; } } for(int i = 10; i < 12; i++){ if(cube[i] != cube[9] || cube[i + 3] != cube[12]){ return false; } } return true; } void turn(int* cube, int i){ switch(i){ case 0: for(int i = 0; i <= 6; i += 3){ swap(cube[i], cube[23 + i]); } swap(cube[20], cube[9]); swap(cube[15], cube[17]); break; case 1: for(int i = 0; i < 3; i++){ swap(cube[i], cube[27 + i]); } swap(cube[14], cube[15]); swap(cube[20], cube[18]); break; case 2: for(int i = 2; i <= 8; i += 3){ swap(cube[i], cube[19 + i]); } swap(cube[18], cube[11]); swap(cube[14], cube[12]); break; case 3: for(int i = 6; i <= 8; i++){ swap(cube[i], cube[15 + i]); } swap(cube[17], cube[12]); swap(cube[9], cube[11]); break; default:break; } } int minimumTurn = 9; void calc(int* cube, int currentTurnCount, int prevTurn){ currentTurnCount++; if(currentTurnCount >= minimumTurn){ return; } for(int i = 0; i < 4; i++){ if(i == prevTurn){ continue; } int tempCube[30]; for(int j = 0; j < 30; j++){ tempCube[j] = cube[j]; } turn(cube, i); if(check(cube)){ minimumTurn = min(minimumTurn, currentTurnCount); return; } calc(cube, currentTurnCount, i); for(int j = 0; j < 30; j++){ cube[j] = tempCube[j]; } } } int main(){ int n = 1; cin << n; for(int k = 0; k < n; k++){ int cube[30]; for(int i = 0; i < 30; i++){ cin >> cube[i]; } minimumTurn = 9; if(!check(cube)){ calc(cube, 0, -1); }else{ minimumTurn = 0; } cout << minimumTurn << endl; } return 0; }
a.cc: In function 'int main()': a.cc:86:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 86 | cin << n; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:86:9: note: candidate: 'operator<<(int, int)' (built-in) 86 | cin << n; | ~~~~^~~~ a.cc:86:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, 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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:86:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 86 | cin << n; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:86:12: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 86 | cin << n; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:86:12: required from here 86 | cin << n; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~
s422480196
p00295
C++
#include <iostream> #include <queue> #include <algorithm> class FC{ public: int p[31]; int n; bool is_over() { return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[9]==p[10] && p[10]==p[11] && p[11] == p[12] && p[12]==p[3] && p[13]==p[14] && p[14]==p[15] && p[15]==p[16] && p[16]==p[17] && p[17]==p[18] && p[18]==p[19] && p[19]==p[20] && p[20]==p[21] && p[21]==p[22] && p[22]==p[23] && p[23]==p[24] && p[24]==p[25] && p[25]==p[26] && p[26]==p[27] && p[27]==p[28] && p[28]==p[29] && p[29]==p[30] && p[30]==p[31]; } void rot1() { swap(p[7],p[22]); swap(p[8],p[23]); swap(p[9],p[24]); swap(p[13] , p[18]); swap(p[10],p[12]); } void rot2() { swap(p[1],p[28]); swap(p[2],p[29]); swap(p[3],p[30]); swap(p[15] , p[16]); swap(p[21],p[19]); } void rot3() { swap(p[1],p[24]); swap(p[4],p[25]); swap(p[7],p[28]); swap(p[10] , p[21]); swap(p[16],p[18]); } void rot4() { swap(p[3],p[22]); swap(p[6],p[25]); swap(p[9],p[30]); swap(p[15] , p[13]); swap(p[12],p[19]); } }; int main() { int N; cin>>N; for(int i=0; i<N; i++){ FC now; for(int j=1; j<30; j++){ cin>>now.p[j]; } now.n=0; queue<FC> que; que.push(now); while(!que.empty()){ now=que.front(); que.pop(); if(now.is_over()){ cout<<now.n<<endl; break; } FC next1=now; next1.rot(); next1.n++; que.push(next1); FC next2=now; next2.rot(); next2.n++; que.push(next2); FC next3=now; next3.rot(); next3.n++; que.push(next3); FC next4=now; next4.rot(); next4.n++; que.push(next4); } } return 0; }
a.cc: In member function 'void FC::rot1()': a.cc:16:17: error: 'swap' was not declared in this scope 16 | swap(p[7],p[22]); swap(p[8],p[23]); swap(p[9],p[24]); swap(p[13] , p[18]); swap(p[10],p[12]); | ^~~~ a.cc:16:17: note: suggested alternatives: In file included from /usr/include/c++/14/queue:66, from a.cc:2: /usr/include/c++/14/bits/stl_queue.h:834:5: note: 'std::swap' 834 | swap(priority_queue<_Tp, _Sequence, _Compare>& __x, | ^~~~ In file included from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /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' /usr/include/c++/14/bits/exception_ptr.h:229:5: note: 'std::__exception_ptr::swap' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ a.cc: In member function 'void FC::rot2()': a.cc:20:17: error: 'swap' was not declared in this scope 20 | swap(p[1],p[28]); swap(p[2],p[29]); swap(p[3],p[30]); swap(p[15] , p[16]); swap(p[21],p[19]); | ^~~~ a.cc:20:17: note: suggested alternatives: /usr/include/c++/14/bits/stl_queue.h:834:5: note: 'std::swap' 834 | swap(priority_queue<_Tp, _Sequence, _Compare>& __x, | ^~~~ /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' /usr/include/c++/14/bits/exception_ptr.h:229:5: note: 'std::__exception_ptr::swap' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ a.cc: In member function 'void FC::rot3()': a.cc:24:17: error: 'swap' was not declared in this scope 24 | swap(p[1],p[24]); swap(p[4],p[25]); swap(p[7],p[28]); swap(p[10] , p[21]); swap(p[16],p[18]); | ^~~~ a.cc:24:17: note: suggested alternatives: /usr/include/c++/14/bits/stl_queue.h:834:5: note: 'std::swap' 834 | swap(priority_queue<_Tp, _Sequence, _Compare>& __x, | ^~~~ /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' /usr/include/c++/14/bits/exception_ptr.h:229:5: note: 'std::__exception_ptr::swap' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ a.cc: In member function 'void FC::rot4()': a.cc:28:17: error: 'swap' was not declared in this scope 28 | swap(p[3],p[22]); swap(p[6],p[25]); swap(p[9],p[30]); swap(p[15] , p[13]); swap(p[12],p[19]); | ^~~~ a.cc:28:17: note: suggested alternatives: /usr/include/c++/14/bits/stl_queue.h:834:5: note: 'std::swap' 834 | swap(priority_queue<_Tp, _Sequence, _Compare>& __x, | ^~~~ /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' /usr/include/c++/14/bits/exception_ptr.h:229:5: note: 'std::__exception_ptr::swap' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ a.cc: In function 'int main()': a.cc:35:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 35 | cin>>N; | ^~~ | std::cin /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:44:17: error: 'queue' was not declared in this scope; did you mean 'std::queue'? 44 | queue<FC> que; | ^~~~~ | std::queue /usr/include/c++/14/bits/stl_queue.h:96:11: note: 'std::queue' declared here 96 | class queue | ^~~~~ a.cc:44:25: error: expected primary-expression before '>' token 44 | queue<FC> que; | ^ a.cc:44:27: error: 'que' was not declared in this scope 44 | queue<FC> que; | ^~~ a.cc:52:33: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 52 | cout<<now.n<<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:52:46: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 52 | cout<<now.n<<endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:56:45: error: 'class FC' has no member named 'rot'; did you mean 'rot1'? 56 | FC next1=now; next1.rot(); next1.n++; que.push(next1); | ^~~ | rot1 a.cc:57:45: error: 'class FC' has no member named 'rot'; did you mean 'rot1'? 57 | FC next2=now; next2.rot(); next2.n++; que.push(next2); | ^~~ | rot1 a.cc:58:45: error: 'class FC' has no member named 'rot'; did you mean 'rot1'? 58 | FC next3=now; next3.rot(); next3.n++; que.push(next3); | ^~~ | rot1 a.cc:59:45: error: 'class FC' has no member named 'rot'; did you mean 'rot1'? 59 | FC next4=now; next4.rot(); next4.n++; que.push(next4); | ^~~ | rot1
s087229709
p00295
C++
#include<iostream> #include<queue> #include<algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2]&&p[2]==p[3]&&p[3]==p[4]&&p[4]==p[5] &&p[5]==p[6]&&p[6]==p[7]&&p[7]==p[8]&&p[8]==p[9] &&p[10]==p[11]&&p[11]==p[12] &&p[13]==p[14]&&p[14]==p[15] &&p[16]==p[17]&&p[17]==p[18] &&p[19]==p[20]&&p[20]==p[21] &&p[22]==p[23]&&p[23]==p[24]&&p[24]==p[25]&&p[25]==p[26] &&p[26]==p[27]&&p[27]==p[28]&&p[28]==p[29]&&p[29]==p[30] } void rot1(){ swap(p[7],p[22]);swap(p[8],p[23]);swap(p[9],p[24]); swap(p[13],p[18]);swap(p[10].p[12]); } void rot2(){ swap(p[1],p[28]);swap(p[2],p[29]);swap(p[3],p[30]); swap(p[15],p[16]);swap(p[19].p[21]); } void rot3(){ swap(p[1],p[24]);swap(p[4],p[27]);swap(p[7],p[30]); swap(p[10],p[21]);swap(p[16].p[18]); } void rot4(){ swap(p[3],p[22]);swap(p[6],p[25]);swap(p[9],p[28]); swap(p[12],p[19]);swap(p[13].p[15]); } }; int main(){ int N; cin>>N; for(int i=0;i<N;i++){ FC now; for(int j=1;j<=30;j++) cin>>nom.p[j]; now.n=0; queue<FC> que; que.push(now); while(!que.empty()){ now=que.front(); que.pop(); if(now.is_over()){ cout<<now.n<<endl; break; } FC nex1=now; nex1.rot1(); nex1.n++; que.push(nex1); FC nex2=now; nex2.rot2(); nex2.n++; que.push(nex2); FC nex3=now; nex3.rot3(); nex3.n++; que.push(nex3); FC nex4=now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc: In member function 'bool FC::is_over()': a.cc:20:9: error: expected ';' before '}' token 20 | } | ^ a.cc: In member function 'void FC::rot1()': a.cc:23:46: error: request for member 'p' in '((FC*)this)->FC::p[10]', which is of non-class type 'int' 23 | swap(p[13],p[18]);swap(p[10].p[12]); | ^ a.cc: In member function 'void FC::rot2()': a.cc:27:46: error: request for member 'p' in '((FC*)this)->FC::p[19]', which is of non-class type 'int' 27 | swap(p[15],p[16]);swap(p[19].p[21]); | ^ a.cc: In member function 'void FC::rot3()': a.cc:31:46: error: request for member 'p' in '((FC*)this)->FC::p[16]', which is of non-class type 'int' 31 | swap(p[10],p[21]);swap(p[16].p[18]); | ^ a.cc: In member function 'void FC::rot4()': a.cc:35:46: error: request for member 'p' in '((FC*)this)->FC::p[13]', which is of non-class type 'int' 35 | swap(p[12],p[19]);swap(p[13].p[15]); | ^ a.cc: In function 'int main()': a.cc:46:30: error: 'nom' was not declared in this scope; did you mean 'now'? 46 | cin>>nom.p[j]; | ^~~ | now
s555244558
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& p[5]==p[6]&&p[6]==p[7}&&p[7]==p[8]&&p[8]==p[9]&& p[10]==p[11}&&p[11]==p[12]&& p[13]==p[14}&&p[14]==p[15]&& p[16]==p[17}&&p[17]==p[18]&& p[19]==p[20}&&p[20]==p[21]; void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ State now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc:12:48: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive] 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^ a.cc:12:48: error: declaration of 'p' as array of references a.cc:12:51: error: expected ';' at end of member declaration 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^ | ; a.cc:12:52: error: expected unqualified-id before '==' token 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^~ a.cc:13:47: error: expected ';' after class definition 13 | p[5]==p[6]&&p[6]==p[7}&&p[7]==p[8]&&p[8]==p[9]&& | ^ | ; a.cc: In member function 'bool FC::is_over()': a.cc:12:45: error: expected ']' before '}' token 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^ a.cc:12:45: error: expected ';' before '}' token a.cc: At global scope: a.cc:13:53: error: expected constructor, destructor, or type conversion before '==' token 13 | p[5]==p[6]&&p[6]==p[7}&&p[7]==p[8]&&p[8]==p[9]&& | ^~ a.cc:14:36: error: expected declaration before '}' token 14 | p[10]==p[11}&&p[11]==p[12]&& | ^ a.cc:14:44: error: expected constructor, destructor, or type conversion before '==' token 14 | p[10]==p[11}&&p[11]==p[12]&& | ^~ a.cc:15:36: error: expected declaration before '}' token 15 | p[13]==p[14}&&p[14]==p[15]&& | ^ a.cc:15:44: error: expected constructor, destructor, or type conversion before '==' token 15 | p[13]==p[14}&&p[14]==p[15]&& | ^~ a.cc:16:36: error: expected declaration before '}' token 16 | p[16]==p[17}&&p[17]==p[18]&& | ^ a.cc:16:44: error: expected constructor, destructor, or type conversion before '==' token 16 | p[16]==p[17}&&p[17]==p[18]&& | ^~ a.cc:17:36: error: expected declaration before '}' token 17 | p[19]==p[20}&&p[20]==p[21]; | ^ a.cc:17:44: error: expected constructor, destructor, or type conversion before '==' token 17 | p[19]==p[20}&&p[20]==p[21]; | ^~ a.cc: In function 'void rot1()': a.cc:21:14: error: 'p' was not declared in this scope 21 | swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); | ^ a.cc: In function 'void rot2()': a.cc:27:14: error: 'p' was not declared in this scope 27 | swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); | ^ a.cc: In function 'void rot3()': a.cc:33:14: error: 'p' was not declared in this scope 33 | swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); | ^ a.cc: In function 'void rot4()': a.cc:39:14: error: 'p' was not declared in this scope 39 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^ a.cc:39:54: error: 'p9' was not declared in this scope 39 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^~ a.cc: At global scope: a.cc:42:1: error: expected declaration before '}' token 42 | }; | ^ a.cc: In function 'int main()': a.cc:50:9: error: 'State' was not declared in this scope 50 | State now; | ^~~~~ a.cc:52:20: error: 'now' was not declared in this scope 52 | cin >> now.p[j]; | ^~~ a.cc:54:9: error: 'now' was not declared in this scope 54 | now.n = 0; | ^~~ a.cc:56:20: error: template argument 2 is invalid 56 | queue<State> que; | ^ a.cc:57:13: error: request for member 'push' in 'que', which is of non-class type 'int' 57 | que.push(now); | ^~~~ a.cc:59:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 59 | while(!que.empty()){ | ^~~~~ a.cc:60:23: error: request for member 'front' in 'que', which is of non-class type 'int' 60 | now = que.front(); | ^~~~~ a.cc:61:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 61 | que.pop(); | ^~~ a.cc:68:18: error: expected ';' before 'nex1' 68 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~~ | ; a.cc:68:32: error: 'nex1' was not declared in this scope 68 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:68:61: error: request for member 'push' in 'que', which is of non-class type 'int' 68 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:69:18: error: expected ';' before 'nex2' 69 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~~ | ; a.cc:69:32: error: 'nex2' was not declared in this scope 69 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:69:61: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:70:18: error: expected ';' before 'nex3' 70 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~~ | ; a.cc:70:32: error: 'nex3' was not declared in this scope 70 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:70:61: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:71:18: error: expected ';' before 'nex4' 71 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~~ | ; a.cc:71:32: error: 'nex4' was not declared in this scope 71 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~ a.cc:71:61: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s198670921
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& p[5]==p[6]&&p[6]==p[7}&&p[7]==p[8]&&p[8]==p[9]&& p[10]==p[11}&&p[11]==p[12]&& p[13]==p[14}&&p[14]==p[15]&& p[16]==p[17}&&p[17]==p[18]&& p[19]==p[20}&&p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ State now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc:12:40: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive] 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^ a.cc:12:40: error: declaration of 'p' as array of references a.cc:12:43: error: expected ';' at end of member declaration 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^ | ; a.cc:12:44: error: expected unqualified-id before '==' token 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^~ a.cc:13:47: error: expected ';' after class definition 13 | p[5]==p[6]&&p[6]==p[7}&&p[7]==p[8]&&p[8]==p[9]&& | ^ | ; a.cc: In member function 'bool FC::is_over()': a.cc:12:37: error: expected ']' before '}' token 12 | return p[1]==p[2]&&p[2]==p[3}&&p[3]==p[4]&&p[4]==p[5]&& | ^ a.cc:12:37: error: expected ';' before '}' token a.cc: At global scope: a.cc:13:53: error: expected constructor, destructor, or type conversion before '==' token 13 | p[5]==p[6]&&p[6]==p[7}&&p[7]==p[8]&&p[8]==p[9]&& | ^~ a.cc:14:36: error: expected declaration before '}' token 14 | p[10]==p[11}&&p[11]==p[12]&& | ^ a.cc:14:44: error: expected constructor, destructor, or type conversion before '==' token 14 | p[10]==p[11}&&p[11]==p[12]&& | ^~ a.cc:15:36: error: expected declaration before '}' token 15 | p[13]==p[14}&&p[14]==p[15]&& | ^ a.cc:15:44: error: expected constructor, destructor, or type conversion before '==' token 15 | p[13]==p[14}&&p[14]==p[15]&& | ^~ a.cc:16:36: error: expected declaration before '}' token 16 | p[16]==p[17}&&p[17]==p[18]&& | ^ a.cc:16:44: error: expected constructor, destructor, or type conversion before '==' token 16 | p[16]==p[17}&&p[17]==p[18]&& | ^~ a.cc:17:36: error: expected declaration before '}' token 17 | p[19]==p[20}&&p[20]==p[21]; | ^ a.cc:17:44: error: expected constructor, destructor, or type conversion before '==' token 17 | p[19]==p[20}&&p[20]==p[21]; | ^~ a.cc:18:6: error: expected declaration before '}' token 18 | } | ^ a.cc: In function 'void rot1()': a.cc:22:14: error: 'p' was not declared in this scope 22 | swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); | ^ a.cc: In function 'void rot2()': a.cc:28:14: error: 'p' was not declared in this scope 28 | swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); | ^ a.cc: In function 'void rot3()': a.cc:34:14: error: 'p' was not declared in this scope 34 | swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); | ^ a.cc: In function 'void rot4()': a.cc:40:14: error: 'p' was not declared in this scope 40 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^ a.cc:40:54: error: 'p9' was not declared in this scope 40 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^~ a.cc: At global scope: a.cc:43:1: error: expected declaration before '}' token 43 | }; | ^ a.cc: In function 'int main()': a.cc:51:9: error: 'State' was not declared in this scope 51 | State now; | ^~~~~ a.cc:53:20: error: 'now' was not declared in this scope 53 | cin >> now.p[j]; | ^~~ a.cc:55:9: error: 'now' was not declared in this scope 55 | now.n = 0; | ^~~ a.cc:57:20: error: template argument 2 is invalid 57 | queue<State> que; | ^ a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int' 58 | que.push(now); | ^~~~ a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 60 | while(!que.empty()){ | ^~~~~ a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int' 61 | now = que.front(); | ^~~~~ a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 62 | que.pop(); | ^~~ a.cc:69:18: error: expected ';' before 'nex1' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~~ | ; a.cc:69:32: error: 'nex1' was not declared in this scope 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:69:61: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:70:18: error: expected ';' before 'nex2' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~~ | ; a.cc:70:32: error: 'nex2' was not declared in this scope 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:70:61: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:71:18: error: expected ';' before 'nex3' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~~ | ; a.cc:71:32: error: 'nex3' was not declared in this scope 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:71:61: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:72:18: error: expected ';' before 'nex4' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~~ | ; a.cc:72:32: error: 'nex4' was not declared in this scope 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~ a.cc:72:61: error: request for member 'push' in 'que', which is of non-class type 'int' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s015351945
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2] && p[2]==p[3} && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7} && p[7]==p[8] && p[8]==p[9] && p[10]==p[11} && p[11]==p[12] && p[13]==p[14} && p[14]==p[15] && p[16]==p[17} && p[17]==p[18] && p[19]==p[20} && p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ State now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc:12:44: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive] 12 | return p[1]==p[2] && p[2]==p[3} && p[3]==p[4] && p[4]==p[5] && | ^ a.cc:12:44: error: declaration of 'p' as array of references a.cc:12:47: error: expected ';' at end of member declaration 12 | return p[1]==p[2] && p[2]==p[3} && p[3]==p[4] && p[4]==p[5] && | ^ | ; a.cc:12:48: error: expected unqualified-id before '==' token 12 | return p[1]==p[2] && p[2]==p[3} && p[3]==p[4] && p[4]==p[5] && | ^~ a.cc:13:41: error: expected ';' after class definition 13 | p[5]==p[6] && p[6]==p[7} && p[7]==p[8] && p[8]==p[9] && | ^ | ; a.cc: In member function 'bool FC::is_over()': a.cc:12:39: error: expected ']' before '}' token 12 | return p[1]==p[2] && p[2]==p[3} && p[3]==p[4] && p[4]==p[5] && | ^ a.cc:12:39: error: expected ';' before '}' token a.cc: At global scope: a.cc:13:49: error: expected constructor, destructor, or type conversion before '==' token 13 | p[5]==p[6] && p[6]==p[7} && p[7]==p[8] && p[8]==p[9] && | ^~ a.cc:14:28: error: expected declaration before '}' token 14 | p[10]==p[11} && p[11]==p[12] && | ^ a.cc:14:38: error: expected constructor, destructor, or type conversion before '==' token 14 | p[10]==p[11} && p[11]==p[12] && | ^~ a.cc:15:28: error: expected declaration before '}' token 15 | p[13]==p[14} && p[14]==p[15] && | ^ a.cc:15:38: error: expected constructor, destructor, or type conversion before '==' token 15 | p[13]==p[14} && p[14]==p[15] && | ^~ a.cc:16:28: error: expected declaration before '}' token 16 | p[16]==p[17} && p[17]==p[18] && | ^ a.cc:16:38: error: expected constructor, destructor, or type conversion before '==' token 16 | p[16]==p[17} && p[17]==p[18] && | ^~ a.cc:17:28: error: expected declaration before '}' token 17 | p[19]==p[20} && p[20]==p[21]; | ^ a.cc:17:38: error: expected constructor, destructor, or type conversion before '==' token 17 | p[19]==p[20} && p[20]==p[21]; | ^~ a.cc:18:6: error: expected declaration before '}' token 18 | } | ^ a.cc: In function 'void rot1()': a.cc:22:14: error: 'p' was not declared in this scope 22 | swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); | ^ a.cc: In function 'void rot2()': a.cc:28:14: error: 'p' was not declared in this scope 28 | swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); | ^ a.cc: In function 'void rot3()': a.cc:34:14: error: 'p' was not declared in this scope 34 | swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); | ^ a.cc: In function 'void rot4()': a.cc:40:14: error: 'p' was not declared in this scope 40 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^ a.cc:40:54: error: 'p9' was not declared in this scope 40 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^~ a.cc: At global scope: a.cc:43:1: error: expected declaration before '}' token 43 | }; | ^ a.cc: In function 'int main()': a.cc:51:9: error: 'State' was not declared in this scope 51 | State now; | ^~~~~ a.cc:53:20: error: 'now' was not declared in this scope 53 | cin >> now.p[j]; | ^~~ a.cc:55:9: error: 'now' was not declared in this scope 55 | now.n = 0; | ^~~ a.cc:57:20: error: template argument 2 is invalid 57 | queue<State> que; | ^ a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int' 58 | que.push(now); | ^~~~ a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 60 | while(!que.empty()){ | ^~~~~ a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int' 61 | now = que.front(); | ^~~~~ a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 62 | que.pop(); | ^~~ a.cc:69:18: error: expected ';' before 'nex1' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~~ | ; a.cc:69:32: error: 'nex1' was not declared in this scope 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:69:61: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:70:18: error: expected ';' before 'nex2' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~~ | ; a.cc:70:32: error: 'nex2' was not declared in this scope 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:70:61: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:71:18: error: expected ';' before 'nex3' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~~ | ; a.cc:71:32: error: 'nex3' was not declared in this scope 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:71:61: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:72:18: error: expected ';' before 'nex4' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~~ | ; a.cc:72:32: error: 'nex4' was not declared in this scope 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~ a.cc:72:61: error: request for member 'push' in 'que', which is of non-class type 'int' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s986490006
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[10]==p[11] && p[11]==p[12] && p[13]==p[14] && p[14]==p[15] && p[16]==p[17] && p[17]==p[18] && p[19]==p[20] && p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ State now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc: In member function 'void FC::rot4()': a.cc:40:54: error: 'p9' was not declared in this scope; did you mean 'p'? 40 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^~ | p a.cc: In function 'int main()': a.cc:51:9: error: 'State' was not declared in this scope 51 | State now; | ^~~~~ a.cc:53:20: error: 'now' was not declared in this scope 53 | cin >> now.p[j]; | ^~~ a.cc:55:9: error: 'now' was not declared in this scope 55 | now.n = 0; | ^~~ a.cc:57:20: error: template argument 2 is invalid 57 | queue<State> que; | ^ a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int' 58 | que.push(now); | ^~~~ a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 60 | while(!que.empty()){ | ^~~~~ a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int' 61 | now = que.front(); | ^~~~~ a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 62 | que.pop(); | ^~~ a.cc:69:18: error: expected ';' before 'nex1' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~~ | ; a.cc:69:32: error: 'nex1' was not declared in this scope 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:69:61: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:70:18: error: expected ';' before 'nex2' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~~ | ; a.cc:70:32: error: 'nex2' was not declared in this scope 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:70:61: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:71:18: error: expected ';' before 'nex3' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~~ | ; a.cc:71:32: error: 'nex3' was not declared in this scope 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:71:61: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:72:18: error: expected ';' before 'nex4' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~~ | ; a.cc:72:32: error: 'nex4' was not declared in this scope 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~ a.cc:72:61: error: request for member 'push' in 'que', which is of non-class type 'int' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s970201443
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[10]==p[11] && p[11]==p[12] && p[13]==p[14] && p[14]==p[15] && p[16]==p[17] && p[17]==p[18] && p[19]==p[20] && p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ State now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc: In member function 'void FC::rot4()': a.cc:40:54: error: 'p9' was not declared in this scope; did you mean 'p'? 40 | swap(p[3], p[22]); swap(p[6], p[25]); swap(p9], p[28]); | ^~ | p a.cc: In function 'int main()': a.cc:51:9: error: 'State' was not declared in this scope 51 | State now; | ^~~~~ a.cc:53:20: error: 'now' was not declared in this scope 53 | cin >> now.p[j]; | ^~~ a.cc:55:9: error: 'now' was not declared in this scope 55 | now.n = 0; | ^~~ a.cc:57:20: error: template argument 2 is invalid 57 | queue<State> que; | ^ a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int' 58 | que.push(now); | ^~~~ a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 60 | while(!que.empty()){ | ^~~~~ a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int' 61 | now = que.front(); | ^~~~~ a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 62 | que.pop(); | ^~~ a.cc:69:18: error: expected ';' before 'nex1' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~~ | ; a.cc:69:32: error: 'nex1' was not declared in this scope 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:69:61: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:70:18: error: expected ';' before 'nex2' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~~ | ; a.cc:70:32: error: 'nex2' was not declared in this scope 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:70:61: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:71:18: error: expected ';' before 'nex3' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~~ | ; a.cc:71:32: error: 'nex3' was not declared in this scope 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:71:61: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:72:18: error: expected ';' before 'nex4' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~~ | ; a.cc:72:32: error: 'nex4' was not declared in this scope 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~ a.cc:72:61: error: request for member 'push' in 'que', which is of non-class type 'int' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s779356725
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[10]==p[11] && p[11]==p[12] && p[13]==p[14] && p[14]==p[15] && p[16]==p[17] && p[17]==p[18] && p[19]==p[20] && p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p[9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ State now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc: In function 'int main()': a.cc:51:9: error: 'State' was not declared in this scope 51 | State now; | ^~~~~ a.cc:53:20: error: 'now' was not declared in this scope 53 | cin >> now.p[j]; | ^~~ a.cc:55:9: error: 'now' was not declared in this scope 55 | now.n = 0; | ^~~ a.cc:57:20: error: template argument 2 is invalid 57 | queue<State> que; | ^ a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int' 58 | que.push(now); | ^~~~ a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 60 | while(!que.empty()){ | ^~~~~ a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int' 61 | now = que.front(); | ^~~~~ a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 62 | que.pop(); | ^~~ a.cc:69:18: error: expected ';' before 'nex1' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~~ | ; a.cc:69:32: error: 'nex1' was not declared in this scope 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:69:61: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | State nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:70:18: error: expected ';' before 'nex2' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~~ | ; a.cc:70:32: error: 'nex2' was not declared in this scope 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:70:61: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | State nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:71:18: error: expected ';' before 'nex3' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~~ | ; a.cc:71:32: error: 'nex3' was not declared in this scope 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:71:61: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | State nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:72:18: error: expected ';' before 'nex4' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~~ | ; a.cc:72:32: error: 'nex4' was not declared in this scope 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~ a.cc:72:61: error: request for member 'push' in 'que', which is of non-class type 'int' 72 | State nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s437937520
p00295
C++
FCFC#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[10]==p[11] && p[11]==p[12] && p[13]==p[14] && p[14]==p[15] && p[16]==p[17] && p[17]==p[18] && p[19]==p[20] && p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p[9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ FC now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc:1:5: error: stray '#' in program 1 | FCFC#include <iostream> | ^ a.cc:1:1: error: 'FCFC' does not name a type 1 | FCFC#include <iostream> | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/deque:62, from /usr/include/c++/14/queue:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/
s153504118
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[10]==p[11] && p[11]==p[12] && p[13]==p[14] && p[14]==p[15] && p[16]==p[17] && p[17]==p[18] && p[19]==p[20] && p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p[9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ FC now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc: In function 'int main()': a.cc:57:15: error: 'State' was not declared in this scope 57 | queue<State> que; | ^~~~~ a.cc:57:20: error: template argument 1 is invalid 57 | queue<State> que; | ^ a.cc:57:20: error: template argument 2 is invalid a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int' 58 | que.push(now); | ^~~~ a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 60 | while(!que.empty()){ | ^~~~~ a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int' 61 | now = que.front(); | ^~~~~ a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 62 | que.pop(); | ^~~ a.cc:69:58: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:70:58: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:71:58: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:72:58: error: request for member 'push' in 'que', which is of non-class type 'int' 72 | FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s927946890
p00295
C++
#include <iostream> #include <queue> #include <algorithm> using namespace std; class FC{ public: int p[31]; int n; bool is_over(){ return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] && p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] && p[10]==p[11] && p[11]==p[12] && p[13]==p[14] && p[14]==p[15] && p[16]==p[17] && p[17]==p[18] && p[19]==p[20] && p[20]==p[21]; } void rot1() { swap(p[7], p[22]); swap(p[8], p[23]); swap(p[9], p[24]); swap(p[10], p[12]); swap(p[13], p[18]); } void rot2() { swap(p[1], p[28]); swap(p[2], p[29]); swap(p[3], p[30]); swap(p[19], p[21]); swap(p[15], p[16]); } void rot3() { swap(p[1], p[24]); swap(p[4], p[27]); swap(p[7], p[30]); swap(p[16], p[18]); swap(p[10], p[21]); } void rot4() { swap(p[3], p[22]); swap(p[6], p[25]); swap(p[9], p[28]); swap(p[13], p[15]); swap(p[12], p[19]); } }; int main() { int N; cin >> N; for(int i=0; i<N; i++){ FC now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<State> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc: In function 'int main()': a.cc:57:15: error: 'State' was not declared in this scope 57 | queue<State> que; | ^~~~~ a.cc:57:20: error: template argument 1 is invalid 57 | queue<State> que; | ^ a.cc:57:20: error: template argument 2 is invalid a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int' 58 | que.push(now); | ^~~~ a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int' 60 | while(!que.empty()){ | ^~~~~ a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int' 61 | now = que.front(); | ^~~~~ a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int' 62 | que.pop(); | ^~~ a.cc:69:58: error: request for member 'push' in 'que', which is of non-class type 'int' 69 | FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:70:58: error: request for member 'push' in 'que', which is of non-class type 'int' 70 | FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:71:58: error: request for member 'push' in 'que', which is of non-class type 'int' 71 | FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:72:58: error: request for member 'push' in 'que', which is of non-class type 'int' 72 | FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s440250234
p00295
C++
int main() { int N; cin >> N; for(int i=0; i<N; i++){ FC now; for(int j=1; j<=30; j++){ cin >> now.p[j]; } now.n = 0; queue<FC> que; que.push(now); while(!que.empty()){ now = que.front(); que.pop(); if(now.is_over()){ cout << now.n << endl; break; } FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); } } return 0; }
a.cc: In function 'int main()': a.cc:4:5: error: 'cin' was not declared in this scope 4 | cin >> N; | ^~~ a.cc:7:9: error: 'FC' was not declared in this scope 7 | FC now; | ^~ a.cc:9:20: error: 'now' was not declared in this scope 9 | cin >> now.p[j]; | ^~~ a.cc:11:9: error: 'now' was not declared in this scope 11 | now.n = 0; | ^~~ a.cc:13:9: error: 'queue' was not declared in this scope 13 | queue<FC> que; | ^~~~~ a.cc:13:19: error: 'que' was not declared in this scope 13 | queue<FC> que; | ^~~ a.cc:21:17: error: 'cout' was not declared in this scope 21 | cout << now.n << endl; | ^~~~ a.cc:21:34: error: 'endl' was not declared in this scope 21 | cout << now.n << endl; | ^~~~ a.cc:25:15: error: expected ';' before 'nex1' 25 | FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~~ | ; a.cc:25:29: error: 'nex1' was not declared in this scope 25 | FC nex1 = now; nex1.rot1(); nex1.n++; que.push(nex1); | ^~~~ a.cc:26:15: error: expected ';' before 'nex2' 26 | FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~~ | ; a.cc:26:29: error: 'nex2' was not declared in this scope 26 | FC nex2 = now; nex2.rot2(); nex2.n++; que.push(nex2); | ^~~~ a.cc:27:15: error: expected ';' before 'nex3' 27 | FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~~ | ; a.cc:27:29: error: 'nex3' was not declared in this scope 27 | FC nex3 = now; nex3.rot3(); nex3.n++; que.push(nex3); | ^~~~ a.cc:28:15: error: expected ';' before 'nex4' 28 | FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~~ | ; a.cc:28:29: error: 'nex4' was not declared in this scope 28 | FC nex4 = now; nex4.rot4(); nex4.n++; que.push(nex4); | ^~~~
s402443530
p00295
C++
#include <iostream> #include <vector> #include <algorithm> #include <cstdio> using namespace std; int n; int dfs(int x[30],d){ if(x[0]==x[1]&&x[1]==x[2]&&x[3]==x[4]&&x[4]==x[5]&&x[5]==x[6]&&x[6]==x[7]&&x[7]==x[8])return d; if(d==8)return 8; int res=8; swap(x[6],x[21]); swap(x[7],x[22]); swap(x[8],x[23]); swap(x[9],x[11]); swap(x[12],x[17]); res=min(res,dfs(x,d+1)); swap(x[6],x[21]); swap(x[7],x[22]); swap(x[8],x[23]); swap(x[9],x[11]); swap(x[12],x[17]); swap(x[0],x[29]); swap(x[1],x[28]); swap(x[2],x[27]); swap(x[14],x[15]); swap(x[18],x[20]); res=min(res,dfs(x,d+1)); swap(x[0],x[29]); swap(x[1],x[28]); swap(x[2],x[27]); swap(x[14],x[15]); swap(x[18],x[20]); swap(x[0],x[29]); swap(x[3],x[26]); swap(x[6],x[23]); swap(x[17],x[15]); swap(x[9],x[20]); res=min(res,dfs(x,d+1)); swap(x[0],x[29]); swap(x[3],x[26]); swap(x[6],x[23]); swap(x[17],x[15]); swap(x[9],x[20]); swap(x[2],x[27]); swap(x[5],x[24]); swap(x[8],x[21]); swap(x[11],x[18]); swap(x[12],x[14]); res=min(res,dfs(x,d+1)); return res; } int main(void){ cin>>n; while(n){ int r[30]; for(int i=0;i<30;i++)cin>>r[i]; cout<<dfs(r,0)<<endl; n--; } }
a.cc:7:19: error: 'd' has not been declared 7 | int dfs(int x[30],d){ | ^ a.cc: In function 'int dfs(int*, int)': a.cc:8:98: error: 'd' was not declared in this scope 8 | if(x[0]==x[1]&&x[1]==x[2]&&x[3]==x[4]&&x[4]==x[5]&&x[5]==x[6]&&x[6]==x[7]&&x[7]==x[8])return d; | ^ a.cc:9:8: error: 'd' was not declared in this scope 9 | if(d==8)return 8; | ^ a.cc:16:23: error: 'd' was not declared in this scope 16 | res=min(res,dfs(x,d+1)); | ^
s367864612
p00296
C
#define rep(i,n) for(i=0;i<n;++i) a[1<<18],v[1<<18][3],n,m,q,c,i,j;main(){scanf("%d%d%d",&n,&m,&q);rep(i,n)rep(j,2)v[i][j]=(i+n+1-2*j)%n;rep(i,m){scanf("%d",a+i);rep(j,a[i])c=v[c][a[i]&1];v[c][2]=1;rep(j,2)v[v[c][j^1]][j]=v[c][j];c=v[c][0];}rep(i,q)scanf("%d",&c),printf("%d\n",1-v[c][2]);exit(0);}
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s889421633
p00296
C++
#include <set> #include <stdio.h> #include <iterator> using namespace std; int main(){ int n,m,q,temp; set<int>s; set<int>::iterator now; scanf("%d%d%d",&n,&m,&q); for(int i=0;i<n;i++)s.insert(i); now=s.find(0); for(int i=0;i<m;i++){ scanf("%d",&temp); if(temp&1){ while(temp){ while(now!=s.end()){ now++; temp--; } if(now==s.end())now=s.begin(); } } else{ while(temp){ while(now!=s.begin()){ now--; temp--; } if(now==s.begin())now=s.end(); } if(now=s.end()); now=s.begin(); } temp=*now; s.erase(now); now=s.lower_bound(temp); } while(q--){ scanf("%d",&temp); if(s.find(temp)==s.end())printf("0\n"); else printf("1\n"); } }
a.cc: In function 'int main()': a.cc:31:19: error: could not convert '(now = s.std::set<int>::end())' from 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} to 'bool' 31 | if(now=s.end()); | ~~~^~~~~~~~ | | | std::set<int>::iterator {aka std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator}
s734295030
p00296
C++
g#include <algorithm> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <functional> #include <iostream> #include <iomanip> #include <iterator> #include <map> #include <queue> #include <set> #include <sstream> #include <utility> #include <vector> using namespace std; typedef long long Long; #define whole(xs) xs.begin(), xs.end() #define uniq(xs) (xs.erase(unique(xs.begin(), xs.end()), xs.end())) template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) { if (vs.empty()) return os << "[]"; os << "[" << vs[0]; for (int i = 1; i < vs.size(); i++) os << " " << vs[i]; return os << "]"; } const int IINF = 1<<28; const Long LINF = 1LL<<56; #define INF IINF struct RangeSumQuery { int N; vector<int> v; static int FindPow2(int x) { int x1 = 1; while (x1 < x) { x1 *= 2; } return x1; } RangeSumQuery(int N_, int init = 0) : N(FindPow2(N_)) { v.clear(); v.resize(N * 2, init); } int dfs(int s, int t, int a, int b, int k) { if (s <= a && b <= t) return v[k]; if (t <= a || b <= s) return 0; int m = (a + b) / 2; return dfs(s, t, a, m, k * 2) + dfs(s, t, m, b, k * 2 + 1); } // 半開区間[s, t)の和を返す int query(int s, int t) { return dfs(s, t, 0, N, 1); } // 要素iにxを加える void add(int i, int x) { i += N; while (i > 0) { v[i] += x; i /= 2; } } }; int N, M, Q; vector<int> A; vector<int> q; void Input() { cin >> N >> M >> Q; A.clear(); A.resize(M); q.clear(); q.resize(Q); for (int i = 0; i < M; i++) cin >> A[i]; for (int j = 0; j < Q; j++) cin >> q[j]; } const int MAX_N = 200001; RangeSumQuery rsq(MAX_N); int Count(int s, int t) { // [s, t)にいきているのが何人いるか assert(s < t); while (s < 0) { s += N; t += N; } int r = t / N; if (t > N) { return rsq.query(s, N) + rsq.query(0, t - N); } else { return rsq.query(s, t); } } void Solve() { for (int i = 0; i < N; i++) { rsq.add(i, 1); } vector<bool> S(N, true); int C = 0; for (int i = 0; i < M; i++) { int a = A[i] % (N - i); if (A[i] & 1) { int lb = 0, ub = N; if (a == 0) { ub = 0; } else { while (lb + 1 < ub) { int mid = (lb + ub) / 2; if (Count(C - mid, C) < a) { lb = mid; } else { ub = mid; } } } int R = (C - ub + N) % N; lb = 0, ub = N; if (a == 1) { ub = 0; } else { while (lb + 1 < ub) { int mid = (lb + ub) / 2; if (Count(C - mid, C) < (a == 0 ? N - 1 : a - 1)) { lb = mid; } else { ub = mid; } } } C = (C - ub + N) % N; S[R] = false; rsq.add(R, -1); } else { int lb = 0, ub = N; if (a == 0) { ub = 0; } else { while (lb + 1 < ub) { int mid = (lb + ub) / 2; if (Count(C + 1, C + 1 + mid) < a) { lb = mid; } else { ub = mid; } } } int R = (C + ub) % N; lb = 0, ub = N; while (lb + 1 < ub) { int mid = (lb + ub) / 2; if (Count(C + 1, C + 1 + mid) < a + 1) { lb = mid; } else { ub = mid; } } C = (C + ub) % N; S[R] = false; rsq.add(R, -1); } } for (int i = 0; i < Q; i++) { cout << S[ q[i] ] << endl; } } int main() { Input(); Solve(); return 0; }
a.cc:1:2: error: stray '#' in program 1 | g#include <algorithm> | ^ a.cc:1:1: error: 'g' does not name a type 1 | g#include <algorithm> | ^ In file included from /usr/include/c++/14/cmath:45, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ In file included from /usr/include/stdlib.h:32, from /usr/include/c++/14/bits/std_abs.h:38, from /usr/include/c++/14/cmath:49: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67, fr
s423058022
p00296
C++
#include <cstdio> #include <iostream> #include <stdlib.h> #include <iomanip> #include <string> #include <sstream> #include <vector> using namespace std; int main(){ int N,M,Q; cin >> N >> M >> Q; int player[N + 1],anser = 0; for(int i = 0;N > i;i++){player[i] = 1;} for(int i = 0;M > i;i++){ //cout << "[anser]" << anser << endl; int a,c = 0; cin >> a; int daturakusya; if(a % 2 == 0){ while(a > 0){ while(true){ anser++; if(anser > N - 1){anser = 0;} if(player[anser] == 1){daturakusya = anser;break;}h } a--; } }else{ while(a > 0){ while(true){ anser--; if(anser < 0){anser = N - 1;} if(player[anser] == 1){daturakusya = anser;break;} } a--; } } player[daturakusya] = 0; //cout << "[daturakusya]" << daturakusya << endl; while(true){ daturakusya++; if(daturakusya > N - 1){daturakusya = 0;} if(player[daturakusya] == 1){ anser = daturakusya; break; } } } for(int i = 0;Q > i;i++){ int q; cin >> q; cout << player[q] << endl; } }
a.cc: In function 'int main()': a.cc:25:71: error: 'h' was not declared in this scope 25 | if(player[anser] == 1){daturakusya = anser;break;}h | ^
s213779173
p00296
C++
#define rep(i,n) for(int i=0;i<n;++i) int a[1<<18],v[1<<18][2],l[1<<18],n,m,q,c; main(){ scanf("%d %d %d",&n,&m,&q); rep(i,n)rep(j,2)v[i][j]=(i+n+1-2*j)%n; rep(i,m){ scanf("%d",a+i); rep(j,a[i])c=v[c][a[i]&1]; l[c]=1; rep(j,2)v[v[c][j^1]][j]=v[c][j]; c=v[c][0]; } rep(i,q) scanf("%d",&c),printf("%d\n",1-l[c]); }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:4:9: error: 'scanf' was not declared in this scope 4 | scanf("%d %d %d",&n,&m,&q); | ^~~~~ a.cc:13:33: error: 'printf' was not declared in this scope 13 | rep(i,q) scanf("%d",&c),printf("%d\n",1-l[c]); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #define rep(i,n) for(int i=0;i<n;++i)
s389587491
p00296
C++
#include <bits/stdc++.h> using namespace std; int N, M, Q; int erased[100001]; int next[100001]; int main() { cin >> N >> M >> Q; for (int i = 0; i < N; i++) next[i] = (i + 1) % N; for (int i = 0; i < N; i++) erased[i] = 1; int c = 0; for (int i = 0; i < M; i++) { int a; cin >> a; if (a % 2) { a = N - (a % N); } for (int j = 0; j < a - 1; j++) { c = next[c]; } erased[next[c]] = 0; next[c] = next[next[c]]; c = next[c]; N--; } for (int i = 0; i < Q; i++) { int a; cin >> a; cout << erased[a] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:33: error: reference to 'next' is ambiguous 10 | for (int i = 0; i < N; i++) next[i] = (i + 1) % N; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:5: note: 'int next [100001]' 6 | int next[100001]; | ^~~~ a.cc:20:17: error: reference to 'next' is ambiguous 20 | c = next[c]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:5: note: 'int next [100001]' 6 | int next[100001]; | ^~~~ a.cc:22:16: error: reference to 'next' is ambiguous 22 | erased[next[c]] = 0; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:5: note: 'int next [100001]' 6 | int next[100001]; | ^~~~ a.cc:23:9: error: reference to 'next' is ambiguous 23 | next[c] = next[next[c]]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:5: note: 'int next [100001]' 6 | int next[100001]; | ^~~~ a.cc:23:19: error: reference to 'next' is ambiguous 23 | next[c] = next[next[c]]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:5: note: 'int next [100001]' 6 | int next[100001]; | ^~~~ a.cc:23:24: error: reference to 'next' is ambiguous 23 | next[c] = next[next[c]]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:5: note: 'int next [100001]' 6 | int next[100001]; | ^~~~ a.cc:24:13: error: reference to 'next' is ambiguous 24 | c = next[c]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:5: note: 'int next [100001]' 6 | int next[100001]; | ^~~~
s569760087
p00296
C++
#include<iostream> #include<vector> using namespace std; int main(){ int n,m,q; cin >> n >> m >> q; int callNomber[m]; for(int i = 0; i < m; i++){ cin >> callNomber[i]; } vector<int> students = vector<int>[n]; for(int i = 0; i < n; i++){ students[i] = i; } int nowBatton = 0; for(int i = 0; i < m; i++){ int tempCall = callNomber[i]; if(tempCall % 2 != 0){ tempCall *= -1; } nowBatton+=tempCall; if(nowBatton >= students.size()){ while(nowBatton>=students.size()){ nowBatton -= students.size(); } } if(nowBatton < 0){ while(nowBatton < 0){ nowBatton+=students.size(); } } students.erase(students.begin() + nowBatton); if(nowBatton == students.size()-1){ nowBatton = 0; } } for(int i = 0; i < q; i++){ int temp; cin >> temp; for(int j = 0; j < students.size();j++){ if(temp == students[j]){ cout << 1 << '\n'; } if(j == students.size()-1){ cout << 0 << '\n'; } } } return 0; }
a.cc: In function 'int main()': a.cc:12:43: error: expected primary-expression before '[' token 12 | vector<int> students = vector<int>[n]; | ^
s121167907
p00296
C++
#include <iostream> #include <vector> using namespace std; #define MAX_N 200010 #define MAX_Q 1010 int N, M, Q; int a[MAX_N]; vector<int> alive; int main() { cin >> N >> M >> Q; for (int i=0; i<N; i++) alive.push_back(i); // O(M) int t = 0; for (int i=0; i<M; i++) { cin >> a[i]; if (a[i] % 2 == 1) t = (t - a[i]) % alive.size(); else t = (t + a[i]) % alive.size(); alive.erase(alive.begin() + t); t = (t + 1) % alive.size(); } // O(N log(N)) for (int i=0; i<Q; i++) { int q; cin >> q; cout << binary_search(alive.begin(), alive.end(), q) << "\n"; } return 0; }
a.cc: In function 'int main()': a.cc:28:13: error: 'binary_search' was not declared in this scope 28 | cout << binary_search(alive.begin(), alive.end(), q) << "\n"; | ^~~~~~~~~~~~~
s293601125
p00296
C++
//PCK2014pre 7 ??????????????¬???///// #include<iostream> #include<string.h> using namespace std; int prev[200000],next[200000]; int main() { int N,M,Q,a,q,o; int ba = 0; cin >> N >> M >> Q; /*for(int i=0;i<N;i++){ if(i==0){ prev[i] = N - 1; next[i] = 1; } else if(i == N-1){ prev[i] = N - 2; next[i] = 0; } else{ prev[i] = i - 1; next[i] = i + 1; } }*/ for(int i=0;i<N;i++){ prev[i] = (i-1+N)%N; next[i] = (i+1)%N; } for(int i=0;i<M;i++){ cin >> a; for(int j=0;j<a;j++) p=a%2==1?prev[p]:next[p]; next[prev[ba]] = next[ba]; prev[next[ba]] = prev[ba]; o = next[ba]; prev[ba] = -1; next[ba] = -1; ba = o; } for(int i=0;i<Q;i++){ cin >> q; if(prev[q] != -1) cout << "1" << endl; else cout << "0" << endl; } /*for(int i=0;i<N;i++) cout << i << " " << prev[i] << " " << next[i] << endl; cout << "AAA";*/ return 0; }
a.cc: In function 'int main()': a.cc:28:9: error: reference to 'prev' is ambiguous 28 | prev[i] = (i-1+N)%N; | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:6:5: note: 'int prev [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:29:9: error: reference to 'next' is ambiguous 29 | next[i] = (i+1)%N; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:18: note: 'int next [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:35:25: error: 'p' was not declared in this scope 35 | p=a%2==1?prev[p]:next[p]; | ^ a.cc:35:34: error: reference to 'prev' is ambiguous 35 | p=a%2==1?prev[p]:next[p]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:6:5: note: 'int prev [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:35:42: error: reference to 'next' is ambiguous 35 | p=a%2==1?prev[p]:next[p]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:18: note: 'int next [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:37:17: error: reference to 'next' is ambiguous 37 | next[prev[ba]] = next[ba]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:18: note: 'int next [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:37:22: error: reference to 'prev' is ambiguous 37 | next[prev[ba]] = next[ba]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:6:5: note: 'int prev [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:37:34: error: reference to 'next' is ambiguous 37 | next[prev[ba]] = next[ba]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:18: note: 'int next [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:38:17: error: reference to 'prev' is ambiguous 38 | prev[next[ba]] = prev[ba]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:6:5: note: 'int prev [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:38:22: error: reference to 'next' is ambiguous 38 | prev[next[ba]] = prev[ba]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:18: note: 'int next [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:38:34: error: reference to 'prev' is ambiguous 38 | prev[next[ba]] = prev[ba]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:6:5: note: 'int prev [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:39:21: error: reference to 'next' is ambiguous 39 | o = next[ba]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:18: note: 'int next [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:40:17: error: reference to 'prev' is ambiguous 40 | prev[ba] = -1; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:6:5: note: 'int prev [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:41:17: error: reference to 'next' is ambiguous 41 | next[ba] = -1; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:6:18: note: 'int next [200000]' 6 | int prev[200000],next[200000]; | ^~~~ a.cc:47:20: error: reference to 'prev' is ambiguous 47 | if(prev[q] != -1) cout << "1" << endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)' 244 | prev(_BidirectionalIterator __x, typename | ^~~~ a.cc:6:5: note: 'int prev [200000]' 6 | int prev[200000],next[200000]; | ^~~~
s756233250
p00296
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> #include <vector> #include <cstdio> using namespace std; int N, M, Q, now = 0; int a, q; vector<int> vec; int main(){ scanf("%d%d%d", &N, &M, &Q); cout << N << endl; for(int i = 0; i < N; i++){ vec.push_back(i); } for(int i = 0; i < M; i++){ scanf("%d", &a); N = vec.size(); if(a % 2){//???????¨??????? if(now - a >= 0){ vec.erase(vec.begin() + now - a); now -= a; } else{ while(now - a < 0){ a += N; } vec.erase(vec.begin() + now - a); now -= a; } } else{ // ????¨??????? if(now + a < N){ vec.erase(vec.begin() + now + a); now += a; } else{ while(now + a > ){ a -= N; } vec.erase(vec.begin() + now + a); now += a; } } for(int i = 0; i < vec.size(); i++){ cout << vec[i] << " "; } cout << endl; } for(int i = 0; i < Q; i++){ scanf("%d", &q); printf("%d\n", binary_search(vec.begin(), vec.end(), q)); } return 0; }
a.cc: In function 'int main()': a.cc:39:49: error: expected primary-expression before ')' token 39 | while(now + a > ){ | ^
s606936525
p00296
C++
#include<bits/stdc++.h> using namespace std; list<int>L; signed main() { cout<<(*x)<<endl; int a, b, c; cin >> a >> b >> c; for (int d = 0; d < a; d++) { L.push_back(d); } auto f = L.begin(); for (int d = 0; d < b; d++) { int e; scanf("%d", &e); for (int g = 0; g < e; g++) { if (e & 1) { if (f == L.begin())f = --L.end(); else f--; } else { f++; if (f == L.end())f = L.begin(); } } L.erase(f); f--; f++; if (f == L.end())f = L.begin(); } for (int s = 0; s < c; s++) { int k; scanf("%d", &k); cout << binary_search(L.begin(), L.end(), k)<<endl; } }
a.cc: In function 'int main()': a.cc:6:13: error: 'x' was not declared in this scope 6 | cout<<(*x)<<endl; | ^
s394272137
p00296
C++
#include<iostream> #include<list> using namespace std; int main(){ int n,m,q; cin >> n >> m >> q; int size = n; list<int> l; for(int i=0;i<n;i++){ table[i] = true; vec.push_back(i); l.push_back(i); } list<int>::iterator index=l.begin(); for(int i=0;i<m;i++){ int tmp=0,j=0; cin >> tmp; if(tmp%2==0){ while(j!=tmp){ index++; if(index==l.end()){ index = l.begin(); } j++; } table[*index] = false; list<int>::iterator tmp=index; index++; if(index==l.end()){ index = l.begin(); } l.erase(tmp); } else{ while(j!=tmp){ if(index==l.begin()){ index = l.end(); index--; } else{ index--; } j++; } table[*index] = false; list<int>::iterator tmp=index; index++; if(index==l.end()){ index = l.begin(); } l.erase(tmp); } } index = l.begin(); for(int i=0;i<q;i++){ int ansindex,ans; cin >> ansindex; ans = (table[ansindex]) ? 1 : 0; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'table' was not declared in this scope; did you mean 'mutable'? 16 | table[i] = true; | ^~~~~ | mutable a.cc:17:5: error: 'vec' was not declared in this scope 17 | vec.push_back(i); | ^~~ a.cc:35:7: error: 'table' was not declared in this scope; did you mean 'mutable'? 35 | table[*index] = false; | ^~~~~ | mutable a.cc:55:7: error: 'table' was not declared in this scope; did you mean 'mutable'? 55 | table[*index] = false; | ^~~~~ | mutable a.cc:71:12: error: 'table' was not declared in this scope; did you mean 'mutable'? 71 | ans = (table[ansindex]) ? 1 : 0; | ^~~~~ | mutable
s651867966
p00296
C++
#include<iostream> #include<list> using namespace std; int main(){ int n,m,q; cin >> n >> m >> q; int size = n; list<int> l; for(int i=0;i<n;i++){ table[i] = true; vec.push_back(i); l.push_back(i); } list<int>::iterator index=l.begin(); for(int i=0;i<m;i++){ int tmp=0,j=0; cin >> tmp; if(tmp%2==0){ while(j!=tmp){ index++; if(index==l.end()){ index = l.begin(); } j++; } table[*index] = false; list<int>::iterator tmp=index; index++; if(index==l.end()){ index = l.begin(); } l.erase(tmp); } else{ while(j!=tmp){ if(index==l.begin()){ index = l.end(); index--; } else{ index--; } j++; } table[*index] = false; list<int>::iterator tmp=index; index++; if(index==l.end()){ index = l.begin(); } l.erase(tmp); } } index = l.begin(); for(int i=0;i<q;i++){ int ansindex,ans; cin >> ansindex; ans = (table[ansindex]) ? 1 : 0; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'table' was not declared in this scope; did you mean 'mutable'? 16 | table[i] = true; | ^~~~~ | mutable a.cc:17:5: error: 'vec' was not declared in this scope 17 | vec.push_back(i); | ^~~ a.cc:35:7: error: 'table' was not declared in this scope; did you mean 'mutable'? 35 | table[*index] = false; | ^~~~~ | mutable a.cc:55:7: error: 'table' was not declared in this scope; did you mean 'mutable'? 55 | table[*index] = false; | ^~~~~ | mutable a.cc:71:12: error: 'table' was not declared in this scope; did you mean 'mutable'? 71 | ans = (table[ansindex]) ? 1 : 0; | ^~~~~ | mutable
s185996384
p00296
C++
#include<iostream> #include<list> using namespace std; int main(){ int n,m,q; cin >> n >> m >> q; int size = n; bool table[n]; list<int> l; for(int i=0;i<n;i++){ table[i] = true; vec.push_back(i); l.push_back(i); } list<int>::iterator index=l.begin(); for(int i=0;i<m;i++){ int tmp=0,j=0; cin >> tmp; if(tmp%2==0){ while(j!=tmp){ index++; if(index==l.end()){ index = l.begin(); } j++; } table[*index] = false; list<int>::iterator tmp=index; index++; if(index==l.end()){ index = l.begin(); } l.erase(tmp); } else{ while(j!=tmp){ if(index==l.begin()){ index = l.end(); index--; } else{ index--; } j++; } table[*index] = false; list<int>::iterator tmp=index; index++; if(index==l.end()){ index = l.begin(); } l.erase(tmp); } } index = l.begin(); for(int i=0;i<q;i++){ int ansindex,ans; cin >> ansindex; ans = (table[ansindex]) ? 1 : 0; cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:19:5: error: 'vec' was not declared in this scope 19 | vec.push_back(i); | ^~~
s317002923
p00296
C++
import static java.util.Arrays.*; import java.io.*; import java.until.*; public class Main { static void tr(Object... os) { System.err.println(deepToString(os)); } void solve() { int n = sc.nextInt(); int m = sc.nextInt(); int q = sc.nextInt(); Node[] nodes = new Node[n]; for (int i = 0; i < n; i++) nodes[i] = new Node(); for (int i = 0; i < n; i++) { nodes[i].next = nodes[(i + 1)%n]; nodes[i].prev = nodes[(i - 1 + n)%n]; } Node cur = nodes[0]; for (int mmm = 0; mmm < m; mmm++) { int a = sc.nextInt(); if (a % 2 == 0) { for (int i = 0; i < a; i++) cur = cur.next; } else { for (int i = 0; i < a; i++) cur = cur.prev; } cur.live = false; cur.prev.next = cur.next; cur.next.prev = cur.prev; cur = cur.next; } for (int qqq = 0; qqq < q; qqq++) { int x = sc.nextInt(); System.out.println(nodes[x].live ? 1 : 0); } } class Node { boolean live = true; Node prev; Node next; } public static void main(String[] args) throws Exception { new Main().run(); } MyScanner sc = null; PrintWriter out = null; public void run() throws Exception { sc = new MyScanner(System.in); out = new PrintWriter(System.out); for (;sc.hasNext();) { solve(); out.flush(); } out.close(); } class MyScanner { String line; BufferedReader reader; StringTokenizer tokenizer; public MyScanner(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public void eat() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { line = reader.readLine(); if (line == null) { tokenizer = null; return; } tokenizer = new StringTokenizer(line); } catch (IOException e) { throw new RuntimeException(e); } } } public String next() { eat(); return tokenizer.nextToken(); } public String nextLine() { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } public boolean hasNext() { eat(); return (tokenizer != null && tokenizer.hasMoreElements()); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } } }
a.cc:1:1: error: 'import' does not name a type 1 | import static java.util.Arrays.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.until.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: expected unqualified-id before 'public' 6 | public class Main { | ^~~~~~
s681345285
p00296
C++
kabv
a.cc:1:1: error: 'kabv' does not name a type 1 | kabv | ^~~~
s368022140
p00297
C++
#include<iostream> #include<string> #include<algorithm> #include<functional> #include<vector> #include<stack> #include<queue> #include<set> #include<map> #include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> #define int long long using namespace std; int n, d; //1 <= n <= 2*10^5, 0 <= d <= 10^9 struct Star { int x, y, b; }star[200000]; int compare(const void *s1, const void *s2) { int t1 = ((Star*)s1)->b; int t2 = ((Star*)s2)->b; return t1 - t2; } signed main() { int i; cin >> n >> d; for( i = 0; i < n; i++ ) cin >> star[i].x >> star[i].y >> star[i].b; qsort(star, n, sizeof(star[0]), compare); static multiset<int> X; static multiset<int> Y; multiset<int>::iterator it; multiset<int>::reverse_iterator rit; int ins = 0; int del = 0; int j; int ans = 0; /*for( i = 0; i < n; i++ ) { printf("index = %d x = %d y = %d b = %d\n", i, star[i].x, star[i].y, star[i].b); }*/ for( i = 0; i < n; i++ ) { ins = i; X.insert( star[ins].x ); Y.insert( star[ins].y ); for(; del < n; del++ ) { if( star[del].b < star[i].b - d ) { it = X.find( star[del].x ); X.erase( it ); it = Y.find( star[del].y ); Y.erase( it ); } else { break; } } it = X.begin(); int minx = *it; rit = X.rbegin(); int maxx = *rit; it = Y.begin(); int miny = *it; rit = Y.rbegin(); int maxy = *rit; ans = max( ans, (maxx - minx) * (maxy - miny) ); //printf("ins = %d, del = %d, x[%d, %d], y[%d, %d]\n", ins, del, minx, maxx, miny, maxy); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:41: error: invalid conversion from 'long long int (*)(const void*, const void*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive] 32 | qsort(star, n, sizeof(star[0]), compare); | ^~~~~~~ | | | long long int (*)(const void*, const void*) In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, 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/stdlib.h:971:34: note: initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)' 971 | __compar_fn_t __compar) __nonnull ((1, 4)); | ~~~~~~~~~~~~~~^~~~~~~~
s172450950
p00297
C++
#include<cstdio> #include<algorithm> #define INF 1e9 using namespace std; typedef long long ll; int n,d; struct data{ ll x,y,c; }; bool comp(const data& d1,const data& d2){ return d1.c<d2.c; }; data s[200001]; struct segtree{ int val,b,s,v2; }; segtree seg[2][1<<22]; void init(){ for(int i=0;i<(1<<22);i++)seg[0][i].s=seg[1][i].s=INF; for(int i=1<<21;i<1<<22;i++)seg[0][i].v2=seg[1][i].v2=i-(1<<22); } void update(int upd,int x,int a){ x+=(1<<21); seg[upd][x].val+=a; if(seg[upd][x].val>=1)seg[upd][x].s=seg[upd][x].b=seg[upd][x].v2; else{ seg[upd][x].s=INF; seg[upd][x].b=0; } while(x>0){ x=(x-1)/2; seg[upd][x].s=min(seg[upd][x*2+1].s,seg[upd][x*2+2].s); seg[upd][x].b=max(seg[upd][x*2+1].b,seg[upd][x*2+2].b); } } int main(void){ scanf("%d%d",&n,&d); init(); for(int i=0;i<n;i++)scanf("%lld%lld%lld",&s[i].x,&s[i].y,&s[i].c); sort(s,s+n,comp); ll res=0; int mc=0; for(int i=0;i<n;i++){ update(0,s[i].x,1); update(1,s[i].y,1); while(s[i].c-s[mc].c>d){ update(0,s[mc].x,-1); update(1,s[mc].y,-1); mc++; } res=max(res,(seg[0][0].b-seg[0][0].s)*(seg[1][0].b-seg[1][0].s)); } printf("%lld\n",res); return 0; }
a.cc: In function 'int main()': a.cc:58:24: error: no matching function for call to 'max(ll&, int)' 58 | res=max(res,(seg[0][0].b-seg[0][0].s)*(seg[1][0].b-seg[1][0].s)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:58:24: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 58 | res=max(res,(seg[0][0].b-seg[0][0].s)*(seg[1][0].b-seg[1][0].s)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:58:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 58 | res=max(res,(seg[0][0].b-seg[0][0].s)*(seg[1][0].b-seg[1][0].s)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s172697708
p00297
C++
#include <iostream> #include <vector> #include <map> #include <cstring> #include <string> #include <stack> #include <queue> #include <cmath> #include <cstdlib> #include <cstdio> #include <algorithm> #include <sstream> #include <set> using namespace std; #define rep(i,n) for(int i=0;i<(int)n;i++) #define repp(i,k,n) for(int i=k;i<(int)n;i++) #define rei(n) for(int i=0;i<(int)n;i++) #define rel(n) for(int l=0;l<(int)n;l++) //#define int long long #define al(s) s.begin(),s.end() #define INT_MAX 2147483647 typedef pair<int, int> pi; typedef pair<pi, pi> ppi; typedef pair<int, ppi> pipp; typedef pair<int, pi> pip; typedef pair<long long, pi> llpi; struct SegTree { int N; vector<long long> Seg; void init(int n) { N = 1; while (N < n)N *= 2; for (int i = 0; i < N*2; i++) { Seg.push_back(INT_MAX); } } void update(int k, int a) { k = k - 1 + N; Seg[k] = a; while (k > 0) { k = (k - 1) / 2; Seg[k] = min(Seg[2 * k + 1], Seg[2 * k + 2]); } } int find_min(int a, int b) { return query(a, b, 0, 0, N); } int query(int a, int b, int k, int l, int r) { if (r <= a || l >= b)return INT_MAX; if (l>=a&&r<=b) { return Seg[k]; } else { return min(query(a, b, k * 2 + 1, l, (r + l) / 2), query(a, b, k * 2 + 2, (r + l) / 2, r)); } } }; SegTree ss[4];//min,max vector<llpi> a; set<long long> s; int main() { long long ans = 0; long long n, d; cin >> n >> d; rei(4)ss[i].init(n); for (int i = 0; i < n; i++) { long long b; int x, y; cin >> x >> y >> b; a.push_back(llpi(b, pi(x, y))); s.insert(b); } for (int i = 0; i < n; i++) { int jj = 0; set<long long> ::iterator it = s.find(a[i].first); for (set<long long>::iterator l = s.begin(); l != it; l++) { jj++; } ss[0].update(jj, min(a[i].second.first, ss[0].Seg[jj + ss[0].N - 1])); ss[2].update(jj, min(a[i].second.first*(-1), ss[2].Seg[jj + ss[0].N - 1])); ss[1].update(jj, min(a[i].second.second, ss[1].Seg[jj + ss[0].N - 1])); ss[3].update(jj, min(a[i].second.second*(-1), ss[3].Seg[jj + ss[0].N - 1])); } bool end = false; for (int i = 0; i < s.size(); i++) { if(end)break; set<long long>::iterator it, ne; it = s.begin(); for (int l = 0; l < i; l++)it++; ne = s.upper_bound(*it + d); if (ne == s.end())end = true; ne--; int coun = 0; for (; it != ne; it++)coun++; coun += i; coun++; ans = max( ans, ((-1) * ss[2].find_min(i, coun) - ss[0].find_min(i, coun)) * ((-1) * ss[3].find_min(i, coun) - ss[1].find_min(i, coun)) ); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:101:37: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 101 | ss[0].update(jj, min(a[i].second.first, ss[0].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:101:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 101 | ss[0].update(jj, min(a[i].second.first, ss[0].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:11: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:101:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 101 | ss[0].update(jj, min(a[i].second.first, ss[0].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:102:37: error: no matching function for call to 'min(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 102 | ss[2].update(jj, min(a[i].second.first*(-1), ss[2].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:102:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 102 | ss[2].update(jj, min(a[i].second.first*(-1), ss[2].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:102:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 102 | ss[2].update(jj, min(a[i].second.first*(-1), ss[2].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:104:37: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 104 | ss[1].update(jj, min(a[i].second.second, ss[1].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:104:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 104 | ss[1].update(jj, min(a[i].second.second, ss[1].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:104:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 104 | ss[1].update(jj, min(a[i].second.second, ss[1].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:105:37: error: no matching function for call to 'min(int, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' 105 | ss[3].update(jj, min(a[i].second.second*(-1), ss[3].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:105:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 105 | ss[3].update(jj, min(a[i].second.second*(-1), ss[3].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:105:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 105 | ss[3].update(jj, min(a[i].second.second*(-1), ss[3].Seg[jj + ss[0].N - 1])); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:122:26: error: no matching function for call to 'max(long long int&, int)' 122 | ans = max( ans, ((-1) * ss[2].find_min(i, coun) - ss[0].find_min(i, coun)) * ((-1) * ss[3].find_min(i, coun) - ss[1].find_min(i, coun)) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argumen
s253696417
p00297
C++
#include<iostream> #include<math.h> #include<algorithm> #include<string> using namespace std; int N; long int d; int maxx,maxy,maxs,kma,kmi,ks,x[200000],y[200000],cnt; struct DATA{ int x,y,b; }; DATA data[200000]; int main(){ cin>>N>>b; for(int i=0;i<N;i++){ cin>>data[i].x>>data[i].y>>data[i].b; } for(int i=0;i<N;i++){ maxx=0;maxy=0;cnt=1; x[0]=data[i].x; y[0]=data[i].y; for(int j=0;j<N;j++){ if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ cnt++; x[cnt]=data[j].x; y[cnt]=data[j].y; } if(j==N-1){ sort(x,x+cnt); sort(y,y+cnt); maxx=x[cnt]-x[0]; maxy=y[cnt]-y[0]; } } ks=maxx*maxy; if(maxs<ks){maxs=ks;kma=maxx;kmi=maxy;} } cout<<maxs<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:17: error: 'b' was not declared in this scope 16 | cin>>N>>b; | ^ a.cc:18:22: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:18:33: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:18:44: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:22:22: error: reference to 'data' is ambiguous 22 | x[0]=data[i].x; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:23:22: error: reference to 'data' is ambiguous 23 | y[0]=data[i].y; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:31: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:41: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:52: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:62: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ |
s749708586
p00297
C++
#include<iostream> #include<math.h> #include<algorithm> #include<string> using namespace std; int N=0; long int b=0; int maxx=0,maxy=0,maxs=0,x[200000],y[200000],cnt=1; struct DATA{ int x,y,b; }; DATA data[200000]; int main(){ cin>>N>>b; for(int i=0;i<N;i++){ cin>>data[i].x>>data[i].y>>data[i].b; } for(int i=0;i<N;i++){ maxx=0;maxy=0;cnt=1; x[0]=data[i].x; y[0]=data[i].y; for(int j=0;j<N;j++){ if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ cnt++; x[cnt]=data[j].x; y[cnt]=data[j].y; } if(j==N-1){ sort(x,x+cnt); sort(y,y+cnt); maxx=x[cnt]-x[0]; maxy=y[cnt]-y[0]; } } ks=maxx*maxy; if(maxs<ks){maxs=ks;kma=maxx;kmi=maxy;} } cout<<maxs<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:22: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:18:33: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:18:44: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:22:22: error: reference to 'data' is ambiguous 22 | x[0]=data[i].x; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:23:22: error: reference to 'data' is ambiguous 23 | y[0]=data[i].y; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:31: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:41: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:52: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:62: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'temp
s218732522
p00297
C++
#include<iostream> #include<math.h> #include<algorithm> #include<string> using namespace std; int N=0; long int b=0; int maxx=0,maxy=0,maxs=0,x[200000],y[200000],cnt=1; struct DATA{ int x,y,b; }; DATA data[200000]; int main(){ cin>>N>>b; for(int i=0;i<N;i++){ cin>>data[i].x>>data[i].y>>data[i].b; } for(int i=0;i<N;i++){ maxx=0;maxy=0;cnt=1; x[0]=data[i].x; y[0]=data[i].y; for(int j=0;j<N;j++){ if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ cnt++; x[cnt]=data[j].x; y[cnt]=data[j].y; } if(j==N-1){ sort(x,x+cnt); sort(y,y+cnt); maxx=x[cnt]-x[0]; maxy=y[cnt]-y[0]; } } ks=maxx*maxy; if(maxs<ks){maxs=ks;} } cout<<maxs<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:22: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:18:33: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:18:44: error: reference to 'data' is ambiguous 18 | cin>>data[i].x>>data[i].y>>data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:22:22: error: reference to 'data' is ambiguous 22 | x[0]=data[i].x; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:23:22: error: reference to 'data' is ambiguous 23 | y[0]=data[i].y; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:31: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:41: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:52: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:13:6: note: 'DATA data [200000]' 13 | DATA data[200000]; | ^~~~ a.cc:26:62: error: reference to 'data' is ambiguous 26 | if(0<=data[i].b-data[j].b&&data[i].b-data[j].b<=b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'temp
s540570130
p00297
C++
#include <bits/stdc++.h> using namespace std; inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} template<class T> inline T sqr(T x) {return x*x;} typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(), (a).rend() #define pb push_back #define mp make_pair #define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define exist(s,e) ((s).find(e)!=(s).end()) #define range(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) range(i,0,n) #define clr(a,b) memset((a), (b) ,sizeof(a)) #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; const double eps = 1e-10; const double pi = acos(-1.0); const ll INF =1LL << 62; const int inf =1 << 30; const int nmax=200010; int n,d; int x[nmax],y[nmax],b[nmax]; int index[nmax]; int offset; int xdata[1<<19][2],ydata[1<<19][2]; void init(int m){ offset=1; while(offset<m) offset*=2; rep(i,2*offset-1){ xdata[i][0]=ydata[i][0]=inf; xdata[i][1]=ydata[i][1]=-inf; } } void update(int data[1<<19][2],int k,int x){ k+=offset-1; data[k][0]=min(data[k][0],x); data[k][1]=max(data[k][1],x); while(k>0){ k=(k-1)/2; data[k][0]=min(data[2*k+1][0],data[2*k+2][0]); data[k][1]=max(data[2*k+1][1],data[2*k+2][1]); } return; } pii query(int data[1<<19][2],int a,int b,int k,int l,int r){ // cerr << a << " " << b <<" " << k << " " << l << " " << r << endl; if(b<=l||r<=a) return make_pair(inf,-inf); if(a<=l&&r<=b) return make_pair(data[k][0],data[k][1]); else{ pii vl=query(data,a,b,2*k+1,l,(l+r)/2); pii vr=query(data,a,b,2*k+2,(l+r)/2,r); return make_pair(min(vl.first,vr.first),max(vl.second,vr.second)); } } int main(void){ cin >> n >> d; rep(i,n) cin >> x[i] >> y[i] >> b[i]; rep(i,n) index[i]=b[i]; sort(index,index+n); int m=unique(index,index+n)-index; init(m); rep(i,n){ int pos=lower_bound(index,index+m,b[i])-index; update(xdata,pos,x[i]); update(ydata,pos,y[i]); } ll ans=0LL; rep(i,m){ int j=upper_bound(index,index+m,index[i]+d)-index; pii xx=query(xdata,i,j,0,0,offset); pii yy=query(ydata,i,j,0,0,offset); ans=max(ans,1LL*(xx.second-xx.first)*(yy.second-yy.first)); } cout << ans << endl; return 0; }
a.cc:36:15: error: 'int index [200010]' redeclared as different kind of entity 36 | int index[nmax]; | ^ In file included from /usr/include/string.h:462, from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)' 50 | extern const char *index (const char *__s, int __c) | ^~~~~ a.cc: In function 'int main()': a.cc:78:23: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 78 | rep(i,n) index[i]=b[i]; | ^ a.cc:79:25: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+' 79 | sort(index,index+n); | ~~~~~^~ a.cc:80:33: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+' 80 | int m=unique(index,index+n)-index; | ~~~~~^~ a.cc:84:48: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+' 84 | int pos=lower_bound(index,index+m,b[i])-index; | ~~~~~^~ a.cc:92:46: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+' 92 | int j=upper_bound(index,index+m,index[i]+d)-index; | ~~~~~^~ a.cc:92:54: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 92 | int j=upper_bound(index,index+m,index[i]+d)-index; | ^
s140959958
p00297
C++
#include<iostream> #include<cmath> #include<string> #include<cctype> #include<vector> #include<numeric> #include<algorithm> #include<bits/std++.h> using namespace std; /** vector<int>ar(3); for(auto&e:ar){ scanf("%d",&e); } sort(ar.begin(),ar.end()) int sum=accumulate(ar.begin(),ar.end(),0); **/ //memo kyuridenamida 1237852 int main(){ double pai=3.141592653589; int N,d; cin >> N >> d; vector< array<int,3> > star; for(int i = 0 ; i < N ; i++){ int x,y,b; cin >> x >> y >> b; star.push_back(array<int,3>{b,x,y}); } sort(star.begin(),star.end()); int l = 0 , r = 0; multiset<int> X,Y; long long ans = 0; while( r != N){ X.insert(star[r][1]); Y.insert(star[r][2]); r++; while( star[r-1][0] - star[l][0] > d ){ X.erase(X.find(star[l][1])); Y.erase(Y.find(star[l][2])); l++; } ans = max((long long)((*X.rbegin())-(*X.begin())) * ((*Y.rbegin())-(*Y.begin())),ans); //cout << (*X.rbegin())-(*X.begin()) << " " << ((*Y.rbegin())-(*Y.begin())) << "|" << star[r-1][0] - star[l][0] << endl; } cout << ans << endl; }
a.cc:8:9: fatal error: bits/std++.h: No such file or directory 8 | #include<bits/std++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s861754895
p00297
C++
#include<bits/std++.h> using namespace std; /** vector<int>ar(3); for(auto&e:ar){ scanf("%d",&e); } sort(ar.begin(),ar.end()) int sum=accumulate(ar.begin(),ar.end(),0); **/ //memo kyuridenamida 1237852 int main(){ double pai=3.141592653589; int N,d; cin >> N >> d; vector< array<int,3> > star; for(int i = 0 ; i < N ; i++){ int x,y,b; cin >> x >> y >> b; star.push_back(array<int,3>{b,x,y}); } sort(star.begin(),star.end()); int l = 0 , r = 0; multiset<int> X,Y; long long ans = 0; while( r != N){ X.insert(star[r][1]); Y.insert(star[r][2]); r++; while( star[r-1][0] - star[l][0] > d ){ X.erase(X.find(star[l][1])); Y.erase(Y.find(star[l][2])); l++; } ans = max((long long)((*X.rbegin())-(*X.begin())) * ((*Y.rbegin())-(*Y.begin())),ans); //cout << (*X.rbegin())-(*X.begin()) << " " << ((*Y.rbegin())-(*Y.begin())) << "|" << star[r-1][0] - star[l][0] << endl; } cout << ans << endl; }
a.cc:1:9: fatal error: bits/std++.h: No such file or directory 1 | #include<bits/std++.h> | ^~~~~~~~~~~~~~ compilation terminated.