submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s920119395 | p03689 | C++ | #include<cstdio>
using namespace std;
const int maxn = 1000000000;
int main()
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if(a % c == 0 && b % d == 0)
{
printf("No\n");
}
int nz = maxn / (c * d - 1);
int nf = (c * d - 1) * maxn + 1;
else
{
printf("Yes\n");
for(int i = 1;i <= a;++i)
{
for(int j = 1;j <= b;++j)
{
if(i % c == 0 && j % d == 0)
printf("-%d ",nf);
else
printf("%d ",nz);
}
putchar('\n');
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'else' without a previous 'if'
14 | else
| ^~~~
|
s166459872 | p03689 | C++ |
#include <iostream>
#include<vector>
using namespace std;
int main() {
int H,W,h,w;cin>>H>>W>>h>>w;
int minus=(H/h)*(W/w);
int plus=(H%h)*W+(W%w)*H-(H%h)*(W%w);
// cout<<minus<<' '<<plus<<endl;
if((H%h)+(W%w)==0){
cout<<"No"<<endl;
return 0;
}else{
cout<<"Yes"<<endl;
}
int def=1;
for(int i=0;i<9;i++){
def*=10;
}
for(int i=1;i<=H;i++){
for(int j=1;j<=W;j++){
int num=(def/(h*w));
if((i%h)+(j%w)==0){
num=-h*w(def/(h*w))+(def/(h*w))-1;
}
cout<<num<<' ';
}
cout<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:41: error: 'w' cannot be used as a function
26 | num=-h*w(def/(h*w))+(def/(h*w))-1;
| ~^~~~~~~~~~~
|
s791470230 | p03689 | C++ | def solve
a,b,h,w=gets.split.map &:to_i
return puts "No" if (a%h).zero? && (b%w).zero?
puts "Yes"
swap = (b%w).zero?
a,b,h,w = b,a,w,h if swap
s = [-1]*b
s[-1]=1
(b-1-w).step(0, -w) do |i|
s[i] = s[i+w] + 1
end
t = [s[0]]
1.upto(s.size-1) do |i|
t << s[i] - s[i-1]
end
t = a.size.times.map{t}
t.transpose if swap
puts t.map{|i| i*" "}
end
solve
| a.cc:1:1: error: 'def' does not name a type
1 | def solve
| ^~~
a.cc:19:3: error: 't' does not name a type
19 | t.transpose if swap
| ^
a.cc:21:1: error: 'end' does not name a type
21 | end
| ^~~
|
s517554988 | p03689 | C++ | #include <iostream>
using namespace std;
int H, W, h, w;
int main {
cin>>H>>W>>h>>w;
if(H%h==0 && W%w==0) {
cout<<"No";
return 0;
}
cout<<"Yes"<<'\n';
int pval=(W/w)*(H/h)*2;
int nval=-pval*(w*h-1)-1;
for(int i=1; i<=H; i++) {
for(int j=1; j<=W; j++) {
if(j%w==0 && i%h==0) {
cout<<nval;
} else {
cout<<pval;
}
if(j!=W) {
cout<<" ";
}
}
cout<<'\n';
}
return 0;
}
| a.cc:4:5: error: cannot declare '::main' to be a global variable
4 | int main {
| ^~~~
a.cc:5:20: error: expected '}' before ';' token
5 | cin>>H>>W>>h>>w;
| ^
a.cc:4:10: note: to match this '{'
4 | int main {
| ^
a.cc:5:17: error: invalid user-defined conversion from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' [-fpermissive]
5 | cin>>H>>W>>h>>w;
| ~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_ios.h:121:16: note: candidate is: 'std::basic_ios<_CharT, _Traits>::operator bool() const [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
121 | explicit operator bool() const
| ^~~~~~~~
/usr/include/c++/14/bits/basic_ios.h:121:16: note: return type 'bool' of explicit conversion function cannot be converted to 'int' with a qualification conversion
a.cc:6:5: error: expected unqualified-id before 'if'
6 | if(H%h==0 && W%w==0) {
| ^~
a.cc:10:5: error: 'cout' does not name a type
10 | cout<<"Yes"<<'\n';
| ^~~~
a.cc:13:5: error: expected unqualified-id before 'for'
13 | for(int i=1; i<=H; i++) {
| ^~~
a.cc:13:18: error: 'i' does not name a type
13 | for(int i=1; i<=H; i++) {
| ^
a.cc:13:24: error: 'i' does not name a type
13 | for(int i=1; i<=H; i++) {
| ^
a.cc:26:5: error: expected unqualified-id before 'return'
26 | return 0;
| ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s830070307 | p03689 | C++ | y | a.cc:1:1: error: 'y' does not name a type
1 | y
| ^
|
s593893671 | p03689 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int H, W, h, w;
cin >> H >> W >> h >> w;
int nrlin = H / h;
int nrcol = W / w;
if (H % h == 0 && W % w == 0)
cout << "No\n";
return 0;
}
else
cout << "Yes\n";
for (int i(1); i <= H; i++)
for (int j(1); j <= W; j++)
cout << (i % h == 0 && j % w == 0 ? -h * w * 1000 - 1 : 1000) << " \n"[j == W];
return 0;
}
| a.cc:16:5: error: expected unqualified-id before 'else'
16 | else
| ^~~~
a.cc:19:5: error: expected unqualified-id before 'for'
19 | for (int i(1); i <= H; i++)
| ^~~
a.cc:19:20: error: 'i' does not name a type
19 | for (int i(1); i <= H; i++)
| ^
a.cc:19:28: error: 'i' does not name a type
19 | for (int i(1); i <= H; i++)
| ^
a.cc:20:24: error: 'j' does not name a type
20 | for (int j(1); j <= W; j++)
| ^
a.cc:20:32: error: 'j' does not name a type
20 | for (int j(1); j <= W; j++)
| ^
a.cc:22:5: error: expected unqualified-id before 'return'
22 | return 0;
| ^~~~~~
a.cc:23:1: error: expected declaration before '}' token
23 | }
| ^
|
s062621808 | p03689 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main () {
double x,y,w,z;
cin >> x >> y >> w >> z;
double aCo1 = (2*x + 2*y - 4);
double aCo2 = (w + z - 1);
double bCo1 = (x*y - aCo1);
double bCo2 = ((w*z) - aCo2);
//Does there exist an integer a where
//a > (b * (bCo1/aCo1))
//a < (b * (bCo2/aCo2))
if (w == x && z == y) {
cout << "No\n";
return 0;
}
if (w == 1 && z == 1) {
cout << "No\n";
return 0;
}
for (long b = 1; b <= 10000; b++) {
double upFrac = b*(bCo1/aCo1);
double downFrac = b*(bCo2/aCo2);
long minA = (floor(upFrac+1));
if (minA < downFrac) {
//Found a
cout << "Yes\n";
for (long i = 0; i < x; i++) {
for (long j = 0; j < y; j++) {
if ((i == 0 && j == (y-1)) ||
(i == 0 && j == 0) ||
(i == (x-1) && j == 0) ||
(i == (x-1) && j == (y-1))) {
cout << a << " ";
} else {
cout << b << " ";
}
}
cout << "\n";
}
return 0;
}
}
cout << "No\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:39:57: error: 'a' was not declared in this scope
39 | cout << a << " ";
| ^
|
s692597458 | p03689 | C++ | #include <iostream>
#include <algorithm>
#include <math>
using namespace std;
int main () {
double x,y,w,z;
cin >> x >> y >> w >> z;
double aCo1 = (2*x + 2*y - 4);
double aCo2 = (w + z - 1);
double bCo1 = (x*y - aCo1);
double bCo2 = ((w*z) - aCo2);
//Does there exist an integer a where
//a > (b * (bCo1/aCo1))
//a < (b * (bCo2/aCo2))
if (w == x && z == y) {
cout << "No\n";
return 0;
}
if (w == 1 && z == 1) {
cout << "No\n";
return 0;
}
for (long b = 1; b <= 10000; b++) {
double upFrac = (bCo1/aCo1);
double downFrac = (bCo2/aCo2);
long minA = (floor(upFrac+1));
if (minA < downFrac) {
//Found a
cout << "Yes\n";
for (long i = 0; i < x; i++) {
for (long j = 0; j < y; j++) {
if ((i == 0 && j == (y-1)) ||
(i == 0 && j == 0) ||
(i == (x-1) && j == 0) ||
(i == (x-1) && j == (y-1))) {
cout << a << " ";
} else {
cout << b << " ";
}
}
cout << "\n";
}
return 0;
}
}
cout << "No\n";
return 0;
} | a.cc:3:10: fatal error: math: No such file or directory
3 | #include <math>
| ^~~~~~
compilation terminated.
|
s754556559 | p03689 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main () {
long H,W,h,w;
cin >> H >> W >> h >> w;
if (h == 1 && w == 1) {
cout << "No\n";
return 0;
}
if (h == H && w == W) {
cout << "No\n";
return 0;
}
long lb = H*W - 4;
long olb = lb;
long ub = abs(4*(w*z - 1));
long oub = ub;
for (long x = lb+1; x <= ub-1; x++) {
if ((x%4) == 0 && x < pow(10,9)) {
//Possible
cout << "Yes\n";
long a = x;
long b = -1;
for (long i = 0; i < H; i++) {
for (long j = 0; j < W; j++) {
if ((i == 0 && j == (W-1)) ||
(i == 0 && j == 0) ||
(i == (H-1) && j == 0) ||
(i == (H-1) && j == (W-1))) {
cout << a << " ";
} else {
cout << b << " ";
}
}
cout << "\n";
}
return 0;
}
}
lb += olb;
ub += oub;
for (long x = lb+1; x <= ub-1; x++) {
if ((x%4) == 0 && x <= pow(10,9)) {
//Possible
cout << "Yes\n";
long a = x;
long b = -2;
for (long i = 0; i < H; i++) {
for (long j = 0; j < W; j++) {
if ((i == 0 && j == (W-1)) ||
(i == 0 && j == 0) ||
(i == (H-1) && j == 0) ||
(i == (H-1) && j == (W-1))) {
cout << a << " ";
} else {
cout << b << " ";
}
}
cout << "\n";
}
return 0;
}
}
lb += olb;
ub += oub;
for (long x = lb+1; x <= ub-1; x++) {
if ((x%4) == 0 && x < pow(10,9)) {
//Possible
cout << "Yes\n";
long a = x;
long b = -3;
for (long i = 0; i < H; i++) {
for (long j = 0; j < W; j++) {
if ((i == 0 && j == (W-1)) ||
(i == 0 && j == 0) ||
(i == (H-1) && j == 0) ||
(i == (H-1) && j == (W-1))) {
cout << a << " ";
} else {
cout << b << " ";
}
}
cout << "\n";
}
return 0;
}
lb += olb;
ub += oub;
for (long x = lb+1; x <= ub-1; x++) {
if ((x%4) == 0 && x < pow(10,9)) {
//Possible
cout << "Yes\n";
long a = x;
long b = -4;
for (long i = 0; i < H; i++) {
for (long j = 0; j < W; j++) {
if ((i == 0 && j == (W-1)) ||
(i == 0 && j == 0) ||
(i == (H-1) && j == 0) ||
(i == (H-1) && j == (W-1))) {
cout << a << " ";
} else {
cout << b << " ";
}
}
cout << "\n";
}
return 0;
}
}
cout << "No\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:19:28: error: 'z' was not declared in this scope
19 | long ub = abs(4*(w*z - 1));
| ^
a.cc:22:39: error: 'pow' was not declared in this scope
22 | if ((x%4) == 0 && x < pow(10,9)) {
| ^~~
a.cc:46:40: error: 'pow' was not declared in this scope
46 | if ((x%4) == 0 && x <= pow(10,9)) {
| ^~~
a.cc:70:39: error: 'pow' was not declared in this scope
70 | if ((x%4) == 0 && x < pow(10,9)) {
| ^~~
a.cc:93:39: error: 'pow' was not declared in this scope
93 | if ((x%4) == 0 && x < pow(10,9)) {
| ^~~
a.cc:117:2: error: expected '}' at end of input
117 | }
| ^
a.cc:5:13: note: to match this '{'
5 | int main () {
| ^
|
s570109098 | p03689 | C++ | [Window Title]
Steam Client WebHelper
[Main Instruction]
Steam Client WebHelper 已停止工作
[Content]
Windows 正在检查该问题的解决方案...
[取消] | a.cc:1:1: error: expected unqualified-id before '[' token
1 | [Window Title]
| ^
|
s417272642 | p03689 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
ll a[501][501];
int main(){
int h,w,h1,w1;
cin>>h>>w>>h1>>w1;
if(((h1==h)&&(w1==w))||((h1==1)&&(w1==1)))
cout<<"No"<<end;
else{
cout<<"Yes"<<endl;
int inx=1;
int indy=1;
ll x=5;
ll y=h1*w1*5-1;
y=-y;
int i,j;
for(i=1;i<=h;i++)
for(j=1;j<=w;j++){
if((i%h1==0)&&(j%w1==0))
a[i][j]=y;
else
a[i][j]=x;
}
for(i=1;i<=h;i++){
for(j=1;j<=w;j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:15: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
12 | cout<<"No"<<end;
| ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | oper |
s220888558 | p03689 | C++ | // In the name of God
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define an size()
using namespace std;
const ll maxn=1e9+7;
ll k[5];
int main()
{
ll W,H,w,h,s,ans=0;
cin>>W>>H>>w>>h;
s=w*h;
cout<<"No";
return 0;
if(W%w==0&&H%h==0)
{
cout<<"No";
}
else
{
for(ll i=1; i<=W; i++)
{
for(ll j=1; j<=H; j++)
{
if(i%w==0&&j%h==0)
{
ans-=s;
}
else
{
ans++;
}
}
}
if(ans<=0)
{
cout<<"No";
}
else
{
while(1==1)
{
w=1//cout<<k[maxn];
}
cout<<"Yes\n";
for(ll i=1; i<=W; i++)
{
for(ll j=1; j<=H; j++)
{
if(i%w==0&&j%h==0)
{
ans-=s;
cout<<-s<<' ';
}
else
{
ans++;
cout<<1<<' ';
}
}
cout<<endl;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:51:20: error: expected ';' before '}' token
51 | w=1//cout<<k[maxn];
| ^
| ;
52 | }
| ~
|
s082490015 | p03689 | C++ | // In the name of God
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define an size()
using namespace std;
const ll maxn=109;
int main()
{
ll W,H,w,h,s;
cin>>W>>H>>w>>h;
s=w*h;
if(W%w==0&&H%h==0)
{
cout<<"No";
}
else
{
ll ans=0; //cout<<"Yes\n";
for(ll i=1; i<=W; i++)
{
for(ll j=1; j<=H; j++)
{
if(i%w==0&&j%h==0)
{
ans-=s;
//cout<<-s<<' ';
}
else
{
ans++;
// cout<<1<<' ';
}
}
}
if(ans<=0)
{
cout<<"No";
}
else
{
cout<"Yes\n";
for(ll i=1; i<=W; i++)
{
for(ll j=1; j<=H; j++)
{
if(i%w==0&&j%h==0)
{
ans-=s;
cout<<-s<<' ';
}
else
{
ans++;
cout<<1<<' ';
}
}
cout<<endl;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:49:17: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [5]')
49 | cout<"Yes\n";
| ~~~~^~~~~~~~
| | |
| | const char [5]
| std::ostream {aka 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:3:
/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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [5]'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [5]'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
49 | cout<"Yes\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:49:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
49 | cout<"Yes\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:49:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
49 | cout<"Yes\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:49:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic |
s385818936 | p03689 | C++ | // In the name of God
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define an size()
using namespace std;
const ll maxn=109;
int main()
{
ll W,H,w,h,s;
cin>>W>>H>>w>>h;
s=w*h;
if(W%w==0&&H%h==0)
{
cout<<"No";
}
else
{
ll ans=0; //cout<<"Yes\n";
for(ll i=1; i<=W; i++)
{
for(ll j=1; j<=H; j++)
{
if(i%w==0&&j%h==0)
{
ans-=s;
//cout<<-s<<' ';
}
else
{
ans++;
// cout<<1<<' ';
}
}
}
if(ans<=0)
{
cout<<"No";
}
else
{
cout<"Yes\n";
for(ll i=1; i<=W; i++)
{
for(ll j=1; j<=H; j++)
{
if(i%w==0&&j%h==0)
{
ans-=s;
cout<<-s<<' ';
}
else
{
ans++;
cout<<1<<' ';
}
}
cout<<endl;
}
}
}
}
| a.cc: In function 'int main()':
a.cc:49:17: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [5]')
49 | cout<"Yes\n";
| ~~~~^~~~~~~~
| | |
| | const char [5]
| std::ostream {aka 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:3:
/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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [5]'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'const char [5]'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
49 | cout<"Yes\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:49:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
49 | cout<"Yes\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:49:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
49 | cout<"Yes\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:49:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'const char*'
49 | cout<"Yes\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:49:18: note: 'std::ostream' {aka 'std::basic |
s409381491 | p03689 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int R, C, R2, C2, r, c;
cin >> R >> C >> R2 >> C2;
if (R % R2 == 0 && C % C2 == 0) FAIL;
int b[500][500] = {};
int useRow = (R%R2 != 0);
for (r = 0; r < R; r++) {
for (c = 0; c < C; c++) {
if (useRow) {
b[r][c] = (r%R2 == 0) ? 1000*(R2-1)-1 : -1000;
} else {
b[r][c] = (c%C2 == 0) ? 1000*(C2-1)-1 : -1000;
}
}
}
// check sum
cout << "Yes\n";
for (r = 0; r < R; r++) {
cout << b[r][0];
for (c = 1; c < C; c++) {
cout << ' ' << b[r][c];
}
cout << '\n';
}
} | a.cc: In function 'int main()':
a.cc:9:41: error: 'FAIL' was not declared in this scope
9 | if (R % R2 == 0 && C % C2 == 0) FAIL;
| ^~~~
|
s721132246 | p03689 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)
int main(){
int H, h, W, w;
cin >> H >> W >> h >> w;
cout << (H%h!=0 || W%w != 0?"Yes":"No") << endl;
if(H%h!=0 || W%w != 0){
bool flag = true;
if(W%w=0){
swap(W, H);
swap(w, h);
flag = true;
}
int sam[W];
int count = 0;
REP(i, W){
if(i%w==w-1){
sam[i] = -1-count;
count++;
}else{
sam[i] = 1000 - count;
}
}
for(int i=W-1;i>0;i--){
sam[i] -= sam[i-1];
}
if(flag){
REP(i, H){
REP(j, W){
cout << sam[j] << " ";
}
cout << endl;
}
}else{
REP(i, W){
REP(j, W){
cout << sam[i] << " ";
}
cout << endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:13: error: lvalue required as left operand of assignment
18 | if(W%w=0){
| ~^~
|
s094239985 | p03689 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
iostream_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int H,W,h,w;
cin>>H>>W>>h>>w;
if(H%h==0&&(W%w==0))
{
cout<<"No\n";
}
else
{
for(int i=1;i<=H;i++)
{
for(int j=1;j<=W;j++)
{
if(i%h==1&&(j%w==1))
{
cout<<(1000000000-1)<<" ";
}
else if(i%h==0&&(j%w==0))
{
cout<<(-1000000000)<<" ";
}
else
{
cout<<0<<" ";
}
}
cout<<"\n";
}
}
} | a.cc: In function 'int main()':
a.cc:5:9: error: 'iostream_base' has not been declared
5 | iostream_base::sync_with_stdio(false);
| ^~~~~~~~~~~~~
|
s192282213 | p03689 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;
#include<map>
#include<set>
#include<queue>
typedef long long ll;
typedef unsigned long long ull;
const int MAX_N = 1000000;
int H, W, h, w;
int main() {
cin >> H >> W >> h >> w;
ll b_g = (H / h) * (W / w);
ll w_g = H * W - b_g;
ll w_s = h * w - 1;
if(h == 1 && w == 1){
cout << "No" << endl;
return;
}
ll nw = 999999990LL / ll(w_s);
ll nb = (-1LL) * (nw * ll(w_s) + 1LL);
if(nb * b_g + nw * w_g <= 0){
cout << "No" << endl;
}
else{
cout << "Yes" << endl;
rep(y, H){
rep(x, W){
if(((y+1) % h == 0) && ((x+1) % w == 0)) printf("%lld", nb);
else printf("%lld", nw);
if(x + 1 == W) cout << endl;
else cout << " ";
}
}
}
} | a.cc: In function 'int main()':
a.cc:33:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
33 | return;
| ^~~~~~
|
s146064633 | p03689 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
long H = sc.nextLong();
long W = sc.nextLong();
long h = sc.nextLong();
long w = sc.nextLong();
long x = (-10000000)*(h*w-1)-1;
String[] ans = new String[H];
for(int i=0; i<H; ++i){
ans[i] = "";
}
long sum = 0;
for(int i=1; i<=H; ++i){
StringBuilder sb = new StringBuilder();
for(int j=1; j<=W; j++){
if(i%h==0 &&j%w==0){
sb.append(x);
sb.append(" ");
sum+=x;
}else{
sb.append(10000000);
sb.append(" ");
sum+=10000000;
}
}
sb.deleteCharAt(sb.length()-1);
ans[i-1] = sb.toString();
}
if(sum<=0) System.out.println("No");
else{
System.out.println("Yes");
for(int i=0; i<H; i++){
System.out.println(ans[i]);
}
}
return;
}
} | Main.java:12: error: incompatible types: possible lossy conversion from long to int
String[] ans = new String[H];
^
1 error
|
s925121436 | p03689 | C++ | /*input
2 4 1 2
*/
#include <bits/stdc++.h>
#define ll long long int
#define lld long double
using namespace std;
int main(){
ios::sync_with_stdio(false);
ll a,b,c,d;cin>>a>>b>>c>>d;
ll array[a+1][b+1]={0};
ll x=0;
for(ll i=c;i<=a;i+=c){
for(ll j=d;j<=b;j+=d){
x++;
}
}
if(((a*b)-x-(x*c*d))==0){
temp=1;
}
ll temp=ceil(x/((a*b)-x-(x*c*d)));
temp++;
ll temp2=(temp*((c*d)-1))+1;
for(ll i=1;i<=a;i++)
for(ll j=1;j<=b;j++)
array[i][j]=temp;
for(ll i=c;i<=a;i+=c){
for(ll j=d;j<=b;j+=d){
//x++;
array[i][j]=(-1)*temp2;
}
}
ll sum=0;
for(ll i=1;i<=a;i++)
for(ll j=1;j<=b;j++)
sum+=array[i][j];
if(sum<0)
cout<<"No\n";
else{
cout<<"Yes\n";
for(ll i=1;i<=a;i++){
for(ll j=1;j<=b;j++)
cout<<array[i][j]<<" ";
cout<<endl;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
19 | temp=1;
| ^~~~
| tm
|
s433329803 | p03689 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int H, W, h, w;
cin >> H >> W >> h >> w;
if (H <= 2 && W <= 2) {
cout << "No" << endl;
return 0;
}
vector< vector<ll> > a(H, vector<ll>(W, min(H, 2) * min(W, 2) * 1e9 / (H * W - min(H, 2) * min(W, 2)) + 1));
a[0][0] = 1e9;
a[0][W - 1] = 1e9;
a[H - 1][0] = 1e9;
a[H - 1][W - 1] = 1e9;
cout << "Yes" << endl;
for (int i = 0; i < H; i++) {
cout << a[i][j];
for (int j = 1; j < W; j++) {
cout << " " << a[i][j];
}
cout << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:30: error: 'j' was not declared in this scope
23 | cout << a[i][j];
| ^
|
s495228754 | p03689 | C++ | LL c1 = 0, c2 = 0;
REP(y, h) REP(x, w) {
if(y <= bh && x <= bw) {
c1++;
} else {
c2++;
}
}
LL d2[500][500] = {};
REP(y, H) REP(x, W) {
}
| a.cc:1:5: error: 'LL' does not name a type
1 | LL c1 = 0, c2 = 0;
| ^~
a.cc:2:8: error: expected constructor, destructor, or type conversion before '(' token
2 | REP(y, h) REP(x, w) {
| ^
a.cc:9:5: error: 'LL' does not name a type
9 | LL d2[500][500] = {};
| ^~
a.cc:10:8: error: expected constructor, destructor, or type conversion before '(' token
10 | REP(y, H) REP(x, W) {
| ^
|
s393567759 | p03689 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int H = sc.nextInt();
int W = sc.nextInt();
int h = sc.nextInt();
int w = sc.nextInt();
ifif( (H-h)%2==0 || (W-w)%2==0 ) System.out.println("No");
System.out.println("Yes");
long s = Math.max(1, (h-1)*(w-1));
long x = (-1)*h*w/s;
for(int i=0; i<H; ++i){
for(int j=0; j<W-1; j++){
if(i%h==0 || j%w==0) System.out.print(1+" ");
else System.out.print(x+" ");
}
System.out.println(1);
}
return;
}
} | Main.java:10: error: ';' expected
ifif( (H-h)%2==0 || (W-w)%2==0 ) System.out.println("No");
^
1 error
|
s833368460 | p03689 | C++ | #include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <bitset>
#include <random>
#include <stack>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <ctime>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define sc second
#define fs first
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> T sqr(T x) { return x*x; }
ld pi = 3.1415926535897932384626433832795;
ll mod = 1e9 + 7;
const int N = 1e5 + 10;
ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a;
}
int a[123456], n;
int main() {
cin >> n;
int mn = 1e9, mx = -1e9, cnt = 0;
for (int i = 0; i < n; i++)
cin >> a[i], cnt += (n - 1 - a[i]), mn = min(mn, a[i]), mx = max(mx, a[i]);
int cnt = 0;
for (int i = 0; i < n; i++)
cnt += a[i] == mx;
if (cnt < n - mx + 1) {
cout << "No";
return 0;
}
if (mx - mn > 1) {
cout << "No";
return 0;
}
if (cnt % (n - 2) != 0) cout << "No";
else cout << "Yes";
return 0;
} | a.cc: In function 'int main()':
a.cc:44:13: error: redeclaration of 'int cnt'
44 | int cnt = 0;
| ^~~
a.cc:41:34: note: 'int cnt' previously declared here
41 | int mn = 1e9, mx = -1e9, cnt = 0;
| ^~~
|
s602945723 | p03689 | C++ | #include<cstdio>
int main()
{
int n,m,h,w;
scanf("%d%d%d%d",&n,&m,&h,&w);
return puts("No"),0; | a.cc: In function 'int main()':
a.cc:7:37: error: expected '}' at end of input
7 | return puts("No"),0;
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s972099863 | p03689 | C++ | if (i % h < r)
cout << 5 * H << " ";
else if (i % h == r)
cout << -5 * H * r - 1 << " ";
else
cout << "0 ";
}
cout << "\n";
}
return 0;
}
if (W % w != 0) {
cout << "Yes\n";
int r = W % w;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if (j % w < r)
cout << 5 * W << " ";
else if (j % w == r)
cout << -5 * W * r - 1 << " ";
else
cout << "0 ";
}
cout << "\n";
}
return 0;
}
cout << "No" << endl;
return 0;
} | a.cc:1:33: error: expected unqualified-id before 'if'
1 | if (i % h < r)
| ^~
a.cc:3:33: error: expected unqualified-id before 'else'
3 | else if (i % h == r)
| ^~~~
a.cc:5:33: error: expected unqualified-id before 'else'
5 | else
| ^~~~
a.cc:7:25: error: expected declaration before '}' token
7 | }
| ^
a.cc:8:25: error: 'cout' does not name a type
8 | cout << "\n";
| ^~~~
a.cc:9:17: error: expected declaration before '}' token
9 | }
| ^
a.cc:10:17: error: expected unqualified-id before 'return'
10 | return 0;
| ^~~~~~
a.cc:11:9: error: expected declaration before '}' token
11 | }
| ^
a.cc:12:9: error: expected unqualified-id before 'if'
12 | if (W % w != 0) {
| ^~
a.cc:28:9: error: 'cout' does not name a type
28 | cout << "No" << endl;
| ^~~~
a.cc:29:9: error: expected unqualified-id before 'return'
29 | return 0;
| ^~~~~~
a.cc:30:1: error: expected declaration before '}' token
30 | }
| ^
|
s372452914 | p03689 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws Exception {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task solver = new Task();
solver.solve(in, out);
out.close();
}
}
class Task {
public void solve(InputReader in, PrintWriter out) {
int H = in.nextInt();
int W = in.nextInt();
int h = in.nextInt();
int w = in.nextInt();
if (H % h == 0 && W % w == 0) {
out.println("No");
return;
}
int cnt = H / h * (W / w);
out.println("Yes");
for (int i = 1; i <= H; i++) {
for (int j = 1; j <= W; j++) {
if (j > 1) out.print(" ");
if (i % h == 0 && j % w == 0) {
out.print(-8000 * w * h + 7999);
} else {
out.print(8000);
}
}
out.println();
}
}
}
}
class InputReader {
private final BufferedReader reader;
private StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public String nextLine() {
try {
return reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(nextLine());
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
| Main.java:53: error: class, interface, enum, or record expected
}
^
1 error
|
s571326894 | p03689 | C++ | using namespace std;
#define ll long long
#define ld long double
#define pll pair <ll , ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define X first
#define Y second
#define LB(x) (x & -(x))
#define BIT(a,b) ((ll)((a)&(1 << (b)))==0 ? false : true)
const ll MAXN=1e5+10;
ll a[MAXN];
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(0);
ll n,u=1000000,t=0,x=0;
cin >> n;
for(ll i=0;i<n;i++)
{
cin >> a[i];
u=min(u , a[i]);
}
for(ll i=0;i<n;i++)
{
if (a[i]!=u)
{
goto E;
}
}
if (u==(n-1) || 2*u<=n)
{
cout << "Yes";
return 0;
}
else
{
cout << "No";
return 0;
}
E:;
for(ll i=0;i<n;i++)
{
if (a[i]>u+1)
{
cout << "No";
return 0;
}
if (a[i]==u)
{
t++;
}
else
{
x++;
}
}
if (x==1)
{
cout << "No";
return 0;
}
if (t<=u && (x/2)+t>=(u+1))
{
cout << "Yes";
return 0;
}
//eweveve
else
{
cout << "No";
return 0;
}
} | a.cc: In function 'int main()':
a.cc:25:5: error: 'ios_base' has not been declared
25 | ios_base :: sync_with_stdio(false);
| ^~~~~~~~
a.cc:26:5: error: 'cin' was not declared in this scope
26 | cin.tie(0);
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:35:11: error: 'min' was not declared in this scope; did you mean 'main'?
35 | u=min(u , a[i]);
| ^~~
| main
a.cc:48:9: error: 'cout' was not declared in this scope
48 | cout << "Yes";
| ^~~~
a.cc:48:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:53:9: error: 'cout' was not declared in this scope
53 | cout << "No";
| ^~~~
a.cc:53:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:63:13: error: 'cout' was not declared in this scope
63 | cout << "No";
| ^~~~
a.cc:63:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:79:9: error: 'cout' was not declared in this scope
79 | cout << "No";
| ^~~~
a.cc:79:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:85:9: error: 'cout' was not declared in this scope
85 | cout << "Yes";
| ^~~~
a.cc:85:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:91:9: error: 'cout' was not declared in this scope
91 | cout << "No";
| ^~~~
a.cc:91:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s877117782 | p03689 | C++ | /*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
const int MOD = 1000000007;
double PI = 4*atan(1);
int H,W,h,w, INF = 500000;
int ans[500];
int main() {
cin >> H >> W >> h >> w;
if (H % h != 0) {
cout << "Yes\n";
F0R(i,H) {
if (i % h == 0) ans[i] = INF;
else if (i % h == (h-1)) ans[i] = -INF-1;
}
ans[H-1] = INF;
F0R(i,H) {
F0R(j,W) cout << ans[i] << " ";
cout << "\n";
}
} /*else if (W % w != 0) {
cout << "Yes\n";
F0R(i,W) {
if (i % w == 0) ans[i] = INF;
else if (i % w == (w-1)) ans[i] = -INF-1;
}
ans[W-1] = INF;
F0R(i,H) {
F0R(j,W) cout << ans[j] << " ";
cout << "\n";
}
}
} | a.cc:44:7: error: unterminated comment
44 | } /*else if (W % w != 0) {
| ^
a.cc: In function 'int main()':
a.cc:44:6: error: expected '}' at end of input
44 | } /*else if (W % w != 0) {
| ^
a.cc:31:12: note: to match this '{'
31 | int main() {
| ^
|
s633036220 | p03689 | C++ | #include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int H, W, h, w;
cin >> H >> W >> h >> w;
l64 mat[H][W];
l64 sum = 0;
u64 m_cnt = 0;
for (int i = 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
if (i%h == h-1 && j%w == w-1) {
mat[i][j] = -1*(h*w);
m_cnt++;
} else {
mat[i][j] = 1;
}
sum += mat[i][j];
}
}
if (sum > 0) {
cout << "Yes" << endl;
for (int i = 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
cout << mat[i][j] << " ";
}
cout << endl;
}
} else if (h*w == 1) {
cout << "No" << endl;
} else if ( (999999999 / (h*w-1)) * (h*w-1) + 1) * (H/h) * (W/w) < (999999999 / (h*w-1)) * H * W ) {
cout << "Yes" << endl;
l64 amp = 999999999 / (h*w-1);
for (int i = 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
if (mat[i][j] == 1) {
cout << amp << " ";
} else {
cout << -1 * ((h*w-1) * amp + 1) << " ";
}
}
cout << endl; }
} else {
cout << "No" << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:41:52: error: invalid type argument of unary '*' (have 'int')
41 | } else if ( (999999999 / (h*w-1)) * (h*w-1) + 1) * (H/h) * (W/w) < (999999999 / (h*w-1)) * H * W ) {
| ^~~~~~~
|
s934511345 | p03689 | C++ | #include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const double PI=acos(-1);
typedef long long ll;
typedef pair<int,int> pi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<=(b);i++)
#define per(i,a,b) for (int i=(a);i>=(b);i--)
#define Rep(i,a,b) for (int i=(a);i<(b);i++)
#define Per(i,a,b) for (int i=(a);i>(b);i--)
//debug
#define deb printf("begin\n");
#define dee printf("end\n");
#define def printf("find\n");
#define dey printf("Yes\n");
#define den printf("No\n");
#define dew printf("wrong\n");
void read(int&x){
x=0;int f=1;char ch=getchar();
while ((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
if (ch=='-')f=-1,ch=getchar();
while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
x*=f;
}
//--------------------------head--------------------------//
#define maxn 1005
int a[maxn][maxn];
int H,R,n,m;
bool check(){
rep(i,1,H)rep(j,1,R)a[i][j]=1;
for (int i=1;i<=H;i+=n)
for (int j=1;j<=R;j+=m)
a[i][j]=-(n*m/4);
int res=0;
rep(i,1,H)rep(j,1,R)res+=a[i][j];
if (a[i][j]>0){
printf("Yes\n");
rep(i,1,H){
rep(j,1,R)printf("%d ",a[i][j]);
printf("\n");
}
}
return true;
}
int main(){
read(H);read(R);read(n);read(m);
rep(i,1,H)rep(j,1,R)a[i][j]=1;
for (int i=n;i<=H;i+=n)
for (int j=m;j<=R;j+=m)
a[i][j]=-n*m;
int res=0;
rep(i,1,H)rep(j,1,R)res+=a[i][j];
if (res<=0){
if (check())printf("No\n");
}
else{
printf("Yes\n");
rep(i,1,H){
rep(j,1,R)printf("%d ",a[i][j]);
printf("\n");
}
}
return 0;
} | a.cc: In function 'bool check()':
a.cc:48:15: error: 'i' was not declared in this scope; did you mean 'pi'?
48 | if (a[i][j]>0){
| ^
| pi
a.cc:48:18: error: 'j' was not declared in this scope
48 | if (a[i][j]>0){
| ^
|
s013479549 | p03689 | C++ | int main(){
puts("No");
}
| a.cc: In function 'int main()':
a.cc:2:5: error: 'puts' was not declared in this scope
2 | puts("No");
| ^~~~
|
s653329506 | p03689 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
long long H, h, W, w;
long long a[1090][1090];
bool check() {
long long sum = 0;
for (int i = 1; i <= H; ++i)
for (int j = 1; j <= W; ++j)
sum += a[i][j];
return sum > 0;
}
int main() {
scanf("%lld %lld %lld %lld", &H, &W, &h, &w);
for (int i = h; i <= H; i += h)
for (int j = w; j <= W; j += w)
a[i][j] = -LL(h*w-1)*260000LL-1LL;
for (int i = 1; i <= H; ++i)
for (int j = 1; j <= W; ++j)
if (a[i][j] == 0) a[i][j] = 260000;
if (check()) {
puts("Yes");
for (int i = 1; i <= H; ++i) {
for (int j = 1; j <= W; ++j)
printf("%lld ", a[i][j]);
putchar('\n');
}
}
else puts("No");
}
| a.cc: In function 'int main()':
a.cc:18:24: error: 'LL' was not declared in this scope
18 | a[i][j] = -LL(h*w-1)*260000LL-1LL;
| ^~
|
s589770407 | p03689 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c) // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
before_main_function() {
#ifdef int
#undef INF
#define INF INFLL
#define stoi stoll
#endif
cin.tie(0);ios::sync_with_stdio(false);
cout<<setprecision(15)<<fixed;
}
} before_main_function;
//------------------------------------------------------------------------------
signed main() {
int H,W,h,w;
cin>>H>>W>>h>>w;
vector<vector<int>> g(H,vector<int>(W,4000));
for(int i=h-1;i<H;i+=h) {
for(int j=w-1;j<W;j+=w) {
g[i][j]=-h*w*4000;
}
}
dump_vvi(g);
int sum=0;
REP(i,H) {
REP(j,W) {
sum+=g[i][j];
}
}
dump(sum);
if(sum<0) {
cout<<"No"<<endl;
}
else {
cout<<"Yes"<<endl;
REP(i,H) {
REP(j,W) {
cout<<g[i][j];
if(j!=W-1) cout<<" ";
else cout<<endl;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:55:5: error: 'dump_vvi' was not declared in this scope
55 | dump_vvi(g);
| ^~~~~~~~
|
s019040790 | p03689 | C++ | #include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
using u8t = std::uint64_t;
using i8t = std::int64_t;
#define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
#define FR(I,N) for(i8t I=N;I--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
int main() {
R(H)R(W)R(h)R(w);
i8t r=H*W-(H/h)*(W/w)*(w*h+1);
if (r>0){
P("Yes");
F(I,H){
bool isfirst=true;
F(J,W){
if(isfirst)isfirst=false;else std::cout<<" ";
bool const a=(I+1)%h==0 &&(J+1)%w==0;
std::cout<<(a?-(w*h):1);
}
std::cout<<std::endl;
}
}else{
P("No");
}
return 0;
} | a.cc:5:18: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
5 | using u8t = std::uint64_t;
| ^~~~~~~~
| wint_t
a.cc:6:18: error: 'int64_t' in namespace 'std' does not name a type
6 | using i8t = std::int64_t;
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:9:14: error: 'i8t' was not declared in this scope; did you mean 'int'?
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:3: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:25: error: 'cin' is not a member of 'std'
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:3: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
4 | #include <string>
+++ |+#include <iostream>
5 | using u8t = std::uint64_t;
a.cc:16:5: error: 'H' was not declared in this scope
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:30: note: in definition of macro 'R'
9 | #define R(V) i8t V;std::cin>>V;
| ^
a.cc:16:9: error: expected ';' before 'W'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:18: note: in definition of macro 'R'
9 | #define R(V) i8t V;std::cin>>V;
| ^
a.cc:9:25: error: 'cin' is not a member of 'std'
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:7: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:25: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:7: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:16:9: error: 'W' was not declared in this scope
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:30: note: in definition of macro 'R'
9 | #define R(V) i8t V;std::cin>>V;
| ^
a.cc:16:13: error: expected ';' before 'h'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:18: note: in definition of macro 'R'
9 | #define R(V) i8t V;std::cin>>V;
| ^
a.cc:9:25: error: 'cin' is not a member of 'std'
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:11: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:25: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:11: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:16:13: error: 'h' was not declared in this scope
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:30: note: in definition of macro 'R'
9 | #define R(V) i8t V;std::cin>>V;
| ^
a.cc:16:17: error: expected ';' before 'w'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:18: note: in definition of macro 'R'
9 | #define R(V) i8t V;std::cin>>V;
| ^
a.cc:9:25: error: 'cin' is not a member of 'std'
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:15: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:25: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
9 | #define R(V) i8t V;std::cin>>V;
| ^~~
a.cc:16:15: note: in expansion of macro 'R'
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:16:17: error: 'w' was not declared in this scope
16 | R(H)R(W)R(h)R(w);
| ^
a.cc:9:30: note: in definition of macro 'R'
9 | #define R(V) i8t V;std::cin>>V;
| ^
a.cc:17:6: error: expected ';' before 'r'
17 | i8t r=H*W-(H/h)*(W/w)*(w*h+1);
| ^~
| ;
a.cc:18:7: error: 'r' was not declared in this scope
18 | if (r>0){
| ^
a.cc:14:19: error: 'cout' is not a member of 'std'
14 | #define P(X) std::cout<<(X)<<std::endl;
| ^~~~
a.cc:19:5: note: in expansion of macro 'P'
19 | P("Yes");
| ^
a.cc:14:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
14 | #define P(X) std::cout<<(X)<<std::endl;
| ^~~~
a.cc:19:5: note: in expansion of macro 'P'
19 | P("Yes");
| ^
a.cc:14:35: error: 'endl' is not a member of 'std'
14 | #define P(X) std::cout<<(X)<<std::endl;
| ^~~~
a.cc:19:5: note: in expansion of macro 'P'
19 | P("Yes");
| ^
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
4 | #include <string>
+++ |+#include <ostream>
5 | using u8t = std::uint64_t;
a.cc:20:7: error: expected ';' before 'I'
20 | F(I,H){
| ^
a.cc:7:24: note: in definition of macro 'F'
7 | #define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
| ^
a.cc:20:7: error: 'I' was not declared in this scope
20 | F(I,H){
| ^
a.cc:7:33: note: in definition of macro 'F'
7 | #define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
| ^
a.cc:7:35: error: '_N' was not declared in this scope
7 | #define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
| ^~
a.cc:20:5: note: in expansion of macro 'F'
20 | F(I,H){
| ^
a.cc:22:9: error: expected ';' before 'J'
22 | F(J,W){
| ^
a.cc:7:24: note: in definition of macro 'F'
7 | #define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
| ^
a.cc:22:9: error: 'J' was not declared in this scope
22 | F(J,W){
| ^
a.cc:7:33: note: in definition of macro 'F'
7 | #define F(I,N) for(i8t I=0,_N=N;I<_N;I++)
| ^
a.cc:23:44: error: 'cout' is not a member of 'std'
23 | if(isfirst)isfirst=false;else std::cout<<" ";
| ^~~~
a.cc:23:44: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:14: error: 'cout' is not a member of 'std'
25 | std::cout<<(a?-(w*h):1);
| ^~~~
a.cc:25:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:12: error: 'cout' is not a member of 'std'
27 | std::cout<<std::endl;
| ^~~~
a.cc:27:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:23: error: 'endl' is not a member of 'std'
27 | std::cout<<std::endl;
| ^~~~
a.cc:27:23: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:14:19: error: 'cout' is not a member of 'std'
14 | #define P(X) std::cout<<(X)<<std::endl;
| ^~~~
a.cc:30:5: note: in expansion of macro 'P'
30 | P("No");
| ^
a.cc:14:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
14 | #define P(X) std::cout<<(X)<<std::endl;
| ^~~~
a.cc:30:5: note: in expansion of macro 'P'
30 | P("No");
| ^
a.cc:14:35: error: 'endl' is not a member of 'std'
14 | #define P(X) std::cout<<(X)<<std::endl;
| ^~~~
a.cc:30:5: note: in expansion of macro 'P'
30 | P("No");
| ^
a.cc:14:35: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
14 | #define P(X) std::cout<<(X)<<std::endl;
| ^~~~
a.cc:30:5: note: in expansion of macro 'P'
30 | P("No");
| ^
|
s715284659 | p03690 | C++ | #include <iostream>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
const int N = 100 * 1000 + 5;
int a[N], b[N];
set <pair <int, int> > s;
map <int, set <int> > mp;
int c[N], d[N];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
a[0] ^= a[i];
}
for (int i = 1; i <= n; i++) {
cin >> b[i];
b[0] ^= b[i];
if (a[i] != b[i]) {
mp[b[i]].insert(i);
s.insert({a[i], i});
}
}
for (int i = 0; i <= n; i++) {
c[i] = a[i];
d[i] = b[i];
}
sort(c, c + n + 1);
sort(d, d + n + 1);
for (int i = 0; i <= n; i++) {
if (c[i] != d[i]) {
cout << -1;
return 0;
}
}
int t = 0;
while (s.size()) {
t++;
if (t > n * 2) {
cout << -2;
return 0;
}
if (mp[a[0]].size()) {
int x = *mp[a[0]].begin();
mp[a[0]].erase(mp[a[0]].begin());
s.erase({a[x], x});
swap(a[0], a[x]);
}
else {
int y = (*s.begin()).second;
if (a[0] != a[y]) {
s.erase(s.begin());
swap(a[0], a[y]);
s.insert({a[y], y});
}
else {
if (a[0] == a[z]) {
int k = 0;
z /= k;
}
int z = (*s.rbegin()).second;
s.erase(*s.rbegin());
swap(a[0], a[z]);
s.insert({a[z], z});
}
}
}
cout << t;
return 0;
} | a.cc: In function 'int main()':
a.cc:64:47: error: 'z' was not declared in this scope
64 | if (a[0] == a[z]) {
| ^
|
s296048832 | p03690 | C++ | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.2")
#define all(x) (x).begin(),(x).end()
int inp(){
int x;
cin >> x;
return x;
}
int get_compos(const int &key, const vector<int> &comp){
return lower_bound(all(comp), key) - comp.begin();
}
void compress(vector<int> &comp){
sort(all(comp));
comp.resize(unique(all(comp)) - comp.begin());
}
void opting(){
ios::sync_with_stdio(false);
cout.tie(0);
cin.tie(0);
}
const int maxn = 2e5 + 69, delta = 1e9 + 7;
vector<int> comp, A, B;
unordered_map<int, int> cnt;
int n;
void input(){
cin >> n;
int x1 = 0;
for(int i = 0; i < n; i++){
int tmp = inp();
x1 ^= tmp;
cnt[tmp] ++;
A.push_back(tmp);
comp.push_back(tmp);
}
cnt[x1]++;
A.push_back(x1);
comp.push_back(x1);
int x2 = 0;
for(int i = 0; i < n; i++){
int tmp = inp();
x2 ^= tmp;
cnt[tmp]--;
B.push_back(tmp);
}
cnt[x2]--;
B.push_back(x2);
for(auto e : cnt)
if(e.second != 0){
cout << -1;
exit(0);
}
}
int E = 0;
bool inside[maxn];
vector<int> adj[maxn];
void add_edge(int u, int v){
adj[u].push_back(v);
E++;
inside[u] = inside[v] = inside[A[n]] = inside[B[n]] = true;
}
bool mark[maxn];
void dfs(int v){
mark[v] = true;
for(auto u : adj[v])
if(!mark[u])
dfs(u);
}
void solve(){
compress(comp);
for(int i = 0; i <= n; i++){
A[i] = get_compos(A[i], comp);
B[i] = get_compos(B[i], comp);
for(int i = 0; i <= n; i++)
if(A[i] != B[i])
add_edge(A[i], B[i]);
int comp_cnt = 0;
for(int i = 0; i <= n; i++)
if(!mark[i] and inside[i])
comp_cnt++, dfs(i);
if(comp_cnt == 0){
cout << 0;
return;
}
if(comp_cnt == 1)
cout << E - 1;
else
cout << E + comp_cnt - 1;
}
int main(){
opting();
input();
solve();
}
| a.cc: In function 'void solve()':
a.cc:115:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
115 | int main(){
| ^~
a.cc:115:9: note: remove parentheses to default-initialize a variable
115 | int main(){
| ^~
| --
a.cc:115:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:115:11: error: a function-definition is not allowed here before '{' token
115 | int main(){
| ^
a.cc:121:2: error: expected '}' at end of input
121 | }
| ^
a.cc:88:13: note: to match this '{'
88 | void solve(){
| ^
|
s870014586 | p03690 | C | //khodaya khodet komak kon
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int N = 200000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;
int n, a[N], b[N], cnt[N], par[N], ans, sz[N];
vi num, G[N], GG[N];
bool mark[N];
int getpar(int v){
return (par[v] == v?v:par[v] = getpar(par[v]));
}
void merge(int v, int u){
v = getpar(v), u = getpar(u);
if (v == u) return;
if (sz[v] < sz[u]) swap(v, u);
ans --;
par[u] = v;
sz[v] += sz[u];
}
int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int X = 0;
cin >> n;
for (int i = 1; i < N; i++) par[i] = i, sz[i] = 1;
for (int i = 1; i <= n; i++){
cin >>a[i];
X ^= a[i];
num.pb(a[i]);
}
a[n + 1] = X;
num.pb(X);
for (int i = 1; i <= n; i++){
cin >> b[i];
num.pb(b[i]);
}
sort(all(num));
num.resize(unique(all(num)) - num.begin());
for (int i = 1; i <= n + 1; i++){
a[i] = lower_bound(all(num), a[i]) - num.begin() + 1;
cnt[a[i]]++;
}
for (int i = 1; i <= n; i++){
b[i] = lower_bound(all(num), b[i]) - num.begin() + 1;
if (cnt[b[i]] == 0) return cout << -1, 0;
cnt[b[i]]--;
}
for (int i = 0; i <N; i++){
if (cnt[i] == 1){
X = i;
break;
}
}
// cout << X << '\n';
memset(cnt, 0, sizeof cnt);
for (int i = 1; i <= n; i++){
if (a[i] == b[i]) continue;
ans ++;
cnt[a[i]]++;
G[b[i]].pb(i);
}
G[b[n + 1]].pb(n + 1);
if (ans == 0) return cout << 0, 0;
ans ++;
ans *= 2;
ans -= 2;
// cout << ans << '\n';
for (int i = 1; i <= n; i++){
if (a[i] == b[i]) continue;
GG[a[i]].pb(i);
}
GG[a[n + 1]].pb(n + 1);
for (int i = 1; i <= n; i++){
if (a[i] == b[i]) continue;
if (!mark[a[i]]){
mark[a[i]] = 1;
for (auto u:G[a[i]]){
merge(i, u);
}
for (auto u:GG[a[i]]) merge(i, u);
}
}
if (!mark[a[n + 1]]){
for (auto u:G[a[n + 1]]){
merge(n + 1, u);
}
}
cout << ans;
return 0;
}
| main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
2 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s285331544 | p03690 | C++ | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
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>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int N;
int A[101010];
int B[101010];
map<int,int> M[2];
map<int,int> T;
int is[101010];
template<int um> class UF {
public:
vector<int> par,rank;
UF() {rank=vector<int>(um,0); for(int i=0;i<um;i++) par.push_back(i);}
int operator[](int x) {return (par[x]==x)?(x):(par[x] = operator[](par[x]));}
int operator()(int x,int y) {
if((x=operator[](x))==(y=operator[](y))) return x;
if(rank[x]>rank[y]) return par[x]=y;
rank[x]+=rank[x]==rank[y]; return par[y]=x;
}
};
UF<500000> uf;
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N;
FOR(i,N) cin>>A[i];
FOR(i,N) cin>>B[i];
int cur[2]={};
FOR(i,N) {
cur[0] ^= A[i];
cur[1] ^= B[i];
M[0][A[i]]++;
M[1][B[i]]++;
T[A[i]]=T[B[i]]=0;
}
M[0][cur[0]]++;
M[1][cur[1]]++;
if(M[0]!=M[1]) return _P("-1\n");
T[cur[0]]=T[cur[1]]=0;
x=0;
FORR(r,T) r.second=x++;
is[T[cur[0]]]=is[T[cur[1]]]=1;
uf(T[cur[0]],T[cur[1]]);
int ns=0;
FOR(i,N) if(A[i]!=B[i]) {
ns++;
is[T[A[i]]]=is[T[B[i]]]=1;
uf(T[A[i]],T[B[i]]);
}
FOR(i,T.size()) if(is[i]&&uf[i]==i) ns++;
ns--;
cout<<ns<<endl;
} | a.cc:94:16: error: macro "FOR" requires 3 arguments, but only 2 given
94 | FOR(i,N) cin>>A[i];
| ^
a.cc:39:9: note: macro "FOR" defined here
39 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
| ^~~
a.cc:95:16: error: macro "FOR" requires 3 arguments, but only 2 given
95 | FOR(i,N) cin>>B[i];
| ^
a.cc:39:9: note: macro "FOR" defined here
39 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
| ^~~
a.cc:97:16: error: macro "FOR" requires 3 arguments, but only 2 given
97 | FOR(i,N) {
| ^
a.cc:39:9: note: macro "FOR" defined here
39 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
| ^~~
a.cc:114:16: error: macro "FOR" requires 3 arguments, but only 2 given
114 | FOR(i,N) if(A[i]!=B[i]) {
| ^
a.cc:39:9: note: macro "FOR" defined here
39 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
| ^~~
a.cc:120:23: error: macro "FOR" requires 3 arguments, but only 2 given
120 | FOR(i,T.size()) if(is[i]&&uf[i]==i) ns++;
| ^
a.cc:39:9: note: macro "FOR" defined here
39 | #define FOR(i,a,b) for(int i=(a);i<(b);++i)
| ^~~
a.cc: In function 'void solve()':
a.cc:94:9: error: 'FOR' was not declared in this scope
94 | FOR(i,N) cin>>A[i];
| ^~~
a.cc:95:12: error: expected ';' before 'cin'
95 | FOR(i,N) cin>>B[i];
| ^ ~~~
| ;
a.cc:97:12: error: expected ';' before '{' token
97 | FOR(i,N) {
| ^ ~
| ;
a.cc:106:31: error: '_P' was not declared in this scope; did you mean 'MP'?
106 | if(M[0]!=M[1]) return _P("-1\n");
| ^~
| MP
a.cc:109:9: error: 'FORR' was not declared in this scope; did you mean 'FOR'?
109 | FORR(r,T) r.second=x++;
| ^~~~
| FOR
a.cc:114:12: error: expected ';' before 'if'
114 | FOR(i,N) if(A[i]!=B[i]) {
| ^ ~~
| ;
a.cc:120:12: error: expected ';' before 'if'
120 | FOR(i,T.size()) if(is[i]&&uf[i]==i) ns++;
| ^ ~~
| ;
|
s750510525 | p03690 | C++ | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
unordered_map<int,int> id;
vector<int> v;
int a[N], b[N], p[N], rk[N], xa[N], xb[N];
int n, N, num;
int find(int x){
return p[x] == x ? x : p[x] = find(p[x]);
}
void unionset(int x, int y){
x = find(x), y= find(y);
if (x == y) return;
if (rk[x] < rk[y]) swap(x,y);
p[y] = x;
if (rk[x] == rk[y]) rk[x]++;
num--;
}
int main(){
scanf("%d",&n);
for (int i = 0; i < n; i++){
scanf("%d",&a[i]);
a[n] ^= a[i];
}
for (int i = 0; i < n; i++){
scanf("%d",&b[i]);
b[n] ^= b[i];
}
for (int i = 0; i <= n; i++){
xa[i] = a[i], xb[i] = b[i];
}
sort(xa,xa+n+1);
sort(xb,xb+n+1);
for (int i = 0; i <= n; i++){
if (xa[i] != xb[i]){
printf("-1");
return 0;
}
}
for (int i = 0; i <= n; i++){
if (a[i] != b[i] || i == n){
N++;
v.push_back(a[i]);
}
}
sort(v.begin(),v.end());
v.erase(unique(v.begin(),v.end()),v.end());
for (auto x : v){
id[x] = num++;
}
num--;
iota(p,p+N,0);
for (int i = 0; i <= n; i++){
if (a[i] != b[i] || i == n){
unionset(id[a[i]],id[b[i]]);
}
}
int ans = N+num-2;
printf("%d",ans);
}
| a.cc:7:8: error: conflicting declaration 'int N'
7 | int n, N, num;
| ^
a.cc:3:11: note: previous declaration as 'const int N'
3 | const int N = 100005;
| ^
a.cc: In function 'int main()':
a.cc:42:13: error: increment of read-only variable 'N'
42 | N++;
| ^
|
s637408770 | p03690 | C++ | #include <bits/stdc++.h>
using namespace std;
int a[100500], b[100500];
int mid[100500], mid2[100500];
int main()
{
int n = 0;
scanf("%d", &n);
for(int i = 1; i <= n; i++) scanf("%d", a + i), a[0] ^= a[i];
for(int i = 1; i <= n; i++) scanf("%d", b + i), b[0] ^= b[i];
for(int i = 0; i <= n; i++) mid[i] = a[i], mid2[i] = b[i];
sort(mid, mid + n + 1), sort(mid2, mid2 + n + 1);
for(int i = 0; i <= n; i++)
if(mid[i] != mid2[i])
{
puts("-1");
return 0;
}
int p = 0, tot = 0;
for(int i = 1; i <= n; i++)
if(a[i] != b[i]) tot++;
if(a[i] == b[i]) cout << tot + 1 << endl;
else cout << tot << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:14: error: 'i' was not declared in this scope
22 | if(a[i] == b[i]) cout << tot + 1 << endl;
| ^
|
s331221914 | p03690 | C++ | #include <iostream>
#include <fstream>
#include <map>
#include <vector>
using namespace std;
const int nmax=100005;
map<int,int> ap,norm;
vector<int> v[nmax];
int viz[nmax],a[nmax],b[nmax];
int n,i,j,nr,edges,cc;
void dfs(int x)
{
viz[x]=1;
for(int i=0;i<v[x].size();i++)
if(!viz[v[x][i]])
dfs(v[x][i]);
}
int main()
{
ios_base::sync_woth_stdio(false);
cin>>n;
for(i=1;i<=n;i++)
cin>>a[i],a[0]^=a[i];
for(j=1;j<=n;j++)
cin>>b[j],b[0]^=b[j];
for(i=0;i<=n;i++)
ap[a[i]]++;
for(i=0;i<=n;i++)
ap[b[i]]--;
for(i=0;i<=n;i++)
if(ap[a[i]]||ap[b[i]])
{
cout<<"-1";
return 0;
}
for(i=0;i<=n;i++)
if((!norm[a[i]])&&(a[i]!=b[i]||i==0))
norm[a[i]]=++nr;
if(!norm[b[0]])
norm[b[0]]=++nr;
for(i=1;i<=n;i++)
if((a[i]!=b[i]))
{
a[i]=norm[a[i]];
b[i]=norm[b[i]];
v[a[i]].push_back(b[i]);
v[b[i]].push_back(a[i]);
edges++;
}
for(int i=1;i<=nr;i++)
if((!viz[i]))
dfs(i),cc++;
cout<<edges+cc-1<<'\n';
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:15: error: 'sync_woth_stdio' is not a member of 'std::ios_base'
20 | ios_base::sync_woth_stdio(false);
| ^~~~~~~~~~~~~~~
|
s564276627 | p03690 | C++ | #include<bit
s/stdc++.h>
const i
nt MAXN = 4e5 + 10;
using namespace std;
inline i
nt read() {
char c
= getchar(); in
t x = 0, f = 1;
while(c < '
0' || c > '9') {if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c
<= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
int N;
int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
map<int, bool> ti;
int find(int x)
{
return fa[x] == x ? fa[x] : fa[x] = find(fa[x]);
}
int unionn(int x, int y) {
fa[x] = y;
}
int main() {
N = read();
for(int i = 1; i <= N; i++) a[i] = read(), sa ^= a[i]; a[N + 1] = sa;
for(int i = 1; i <= N; i++) b[i] = read(), sb ^= b[i]; b[N + 1] = sb;
N++;
memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
sort(ta + 1, ta + N + 1); sort(tb + 1, tb + N + 1);
for(int i = 1; i <= N - 1; i++) if(ta[i] != tb[i]) return puts("-1"), 0;
int ans = 0, num = 0;
for(int i = 1; i
<= N; i++)
if(a[i] != b[i] || (i == N)) {
date[+
+num] = a[i]; date[++num] = b[i];
if(i < N)
ans++;
}
if(ans == 0) return puts("0"), 0;
sort(date + 1, date + num
+ 1);
num = unique(date + 1, date + num + 1) - date - 1;
for(int i = 1; i <= num
; i++) fa[i] = i;
for(int i = 1; i <=
N; i++)
if(a[i] != b[i]) {
a[i] = lower
_bound(date + 1, date + num + 1, a[i]) - date,
b[i] = lower_b
ound(date + 1, date + num + 1, b[i]) - date;
if(!ti[a[i]]) ti[a[i]] = 1;
if(!ti[b[i]]) ti[
b[i]] = 1;
unionn(find(a[i]), find(b[i]));
}
for(int i = 1; i <= num; i++)
if(fa[i] == i) ans++;
printf("%d", ans - 1);
return 0;
} | a.cc:1:13: error: missing terminating > character
1 | #include<bit
| ^
a.cc:13:15: warning: missing terminating ' character
13 | while(c < '
| ^
a.cc:13:15: error: missing terminating ' character
a.cc:14:6: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
14 | 0' || c > '9') {if(c == '-') f = -1; c = getchar();}
| ^~~~~~~~~~
a.cc:14:17: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
14 | 0' || c > '9') {if(c == '-') f = -1; c = getchar();}
| ^~~~~~~~~~~~~
a.cc:14:31: warning: missing terminating ' character
14 | 0' || c > '9') {if(c == '-') f = -1; c = getchar();}
| ^
a.cc:14:31: error: missing terminating ' character
14 | 0' || c > '9') {if(c == '-') f = -1; c = getchar();}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:2:1: error: 's' does not name a type
2 | s/stdc++.h>
| ^
a.cc:6:8: error: 'i' does not name a type
6 | inline i
| ^
a.cc:21:7: error: 'MAXN' was not declared in this scope
21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
| ^~~~
a.cc:21:16: error: 'MAXN' was not declared in this scope
21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
| ^~~~
a.cc:21:26: error: 'MAXN' was not declared in this scope
21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
| ^~~~
a.cc:21:36: error: 'MAXN' was not declared in this scope
21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
| ^~~~
a.cc:21:65: error: 'MAXN' was not declared in this scope
21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
| ^~~~
a.cc:21:75: error: 'MAXN' was not declared in this scope
21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
| ^~~~
a.cc:22:1: error: 'map' does not name a type
22 | map<int, bool> ti;
| ^~~
a.cc: In function 'int find(int)':
a.cc:25:12: error: 'fa' was not declared in this scope; did you mean 'sa'?
25 | return fa[x] == x ? fa[x] : fa[x] = find(fa[x]);
| ^~
| sa
a.cc: In function 'int unionn(int, int)':
a.cc:28:5: error: 'fa' was not declared in this scope; did you mean 'sa'?
28 | fa[x] = y;
| ^~
| sa
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
29 | }
| ^
a.cc: In function 'int main()':
a.cc:31:9: error: 'read' was not declared in this scope
31 | N = read();
| ^~~~
a.cc:32:33: error: 'a' was not declared in this scope
32 | for(int i = 1; i <= N; i++) a[i] = read(), sa ^= a[i]; a[N + 1] = sa;
| ^
a.cc:32:60: error: 'a' was not declared in this scope; did you mean 'sa'?
32 | for(int i = 1; i <= N; i++) a[i] = read(), sa ^= a[i]; a[N + 1] = sa;
| ^
| sa
a.cc:33:33: error: 'b' was not declared in this scope
33 | for(int i = 1; i <= N; i++) b[i] = read(), sb ^= b[i]; b[N + 1] = sb;
| ^
a.cc:33:60: error: 'b' was not declared in this scope; did you mean 'sb'?
33 | for(int i = 1; i <= N; i++) b[i] = read(), sb ^= b[i]; b[N + 1] = sb;
| ^
| sb
a.cc:35:12: error: 'ta' was not declared in this scope; did you mean 'sa'?
35 | memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
| ^~
| sa
a.cc:35:5: error: 'memcpy' was not declared in this scope
35 | memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
| ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<bit
+++ |+#include <cstring>
2 | s/stdc++.h>
a.cc:35:38: error: 'tb' was not declared in this scope; did you mean 'sb'?
35 | memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
| ^~
| sb
a.cc:36:5: error: 'sort' was not declared in this scope; did you mean 'short'?
36 | sort(ta + 1, ta + N + 1); sort(tb + 1, tb + N + 1);
| ^~~~
| short
a.cc:37:63: error: 'puts' was not declared in this scope
37 | for(int i = 1; i <= N - 1; i++) if(ta[i] != tb[i]) return puts("-1"), 0;
| ^~~~
a.cc:43:13: error: 'date' was not declared in this scope
43 | date[+
| ^~~~
a.cc:49:25: error: 'puts' was not declared in this scope
49 | if(ans == 0) return puts("0"), 0;
| ^~~~
a.cc:52:10: error: 'date' was not declared in this scope
52 | sort(date + 1, date + num
| ^~~~
a.cc:55:11: error: 'unique' was not declared in this scope
55 | num = unique(date + 1, date + num + 1) - date - 1;
| ^~~~~~
a.cc:57:12: error: 'fa' was not declared in this scope; did you mean 'sa'?
57 | ; i++) fa[i] = i;
| ^~
| sa
a.cc:61:20: error: 'lower' was not declared in this scope
61 | a[i] = lower
| ^~~~~
a.cc:65:17: error: 'ti' was not declared in this scope; did you mean 'i'?
65 | if(!ti[a[i]]) ti[a[i]] = 1;
| ^~
| i
a.cc:66:17: error: 'ti' was not declared in this scope; did you mean 'i'?
66 | if(!ti[b[i]]) ti[
| ^~
| i
a.cc:72:12: error: 'fa' was not declared in this scope; did you mean 'sa'?
72 | if(fa[i] == i) ans++;
| ^~
| sa
a.cc:73:5: error: 'printf' was not declared in this scope
73 | printf("%d", ans - 1);
| ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
1 | #include<bit
+++ |+#include <cstdio>
2 | s/stdc++.h>
|
s577039207 | p03690 | C++ | #include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;
int N;
int A[114514];
int B[114514];
map<int, multiset<int>> es;
int main() {
scanf("%d", &N);
int x = 0;
rep(i, N) {
scanf("%d", &A[i]);
x ^= A[i];
}
rep(i, N) {
scanf("%d", &B[i]);
if (A[i] != B[i]) es[B[i]].insert(A[i]);
}
int defx = x;
int ans = 0;
while (!es.empty()) {
if (!es.count(x)) {
assert(!es.empty());
ans++;
int want = es.begin()->X;
assert(!es[want].empty());
int give = *es[want].begin();
if (defx == give) given = *es[want].rbegin();
es[want].erase(es[want].find(give));
es[want].insert(x);
x = give;
}
if (!es.count(x)) {
puts("-1");
return 0;
}
ans++;
int give = *es[x].begin();
if (defx == give) given = *es[x].rbegin();
es[x].erase(es[x].find(give));
if (es[x].empty()) es.erase(x);
x = give;
}
printf("%d\n", ans);
}
| a.cc: In function 'int main()':
a.cc:56:25: error: 'given' was not declared in this scope; did you mean 'give'?
56 | if (defx == give) given = *es[want].rbegin();
| ^~~~~
| give
a.cc:69:23: error: 'given' was not declared in this scope; did you mean 'give'?
69 | if (defx == give) given = *es[x].rbegin();
| ^~~~~
| give
|
s386312269 | p03690 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
struct node {
int x,id;
}ord[100005],ord2[100005];
int n,flag;
int fa[100005],a[100005],b[100005],c[100005],c2[100005],vis[100005],v[100005];
map<int,int> mp;
bool cmp(node a, node b) {
return a.x<b.x;
}
int Find(int x){
if(fa[x]!=x) fa[x]=Find(fa[x]);
return fa[x];
}
void Unionn(int x,int y) {
x=Find(x); y=Find(y);
fa[x]=y;
}
void Discrete(){
int cnt=1;
sort(ord+1, ord+2+n, cmp);
c[ord[1].id]=cnt++;
for(int i=2; i<=n+1; i++) {
if(ord[i].x==ord[i-1].x) cnt--;
c[ord[i].id]=cnt++;
}
cnt=1;
sort(ord2+1, ord2+2+n, cmp);
c2[ord2[1].id]=cnt++;
for(int i=2; i<=n+1; i++) {
if(ord2[i].x==ord2[i-1].x) cnt--;
c2[ord2[i].id]=cnt++;
}
}
int main(void)
{
int ans=0;
cin >>n;
for(int i=1; i<=n; i++) {
scanf("%d",&a[i]);
ord[i]=(node){a[i],i};
a[n+1]^=a[i];
mp[a[i]]++;
}
mp[a[n+1]]++;
ord[n+1]=(node){a[n+1],n+1};
for(int i=1; i<=n; i++) {
scanf("%d",&b[i]);
ord2[i] =(node){b[i],i};
b[n+1]^=b[i];
mp[b[i]]--;
}
ord2[n+1]=(node){b[n+1],n+1};
mp[b[n+1]]--;
for(map<int,int>::iterator it=mp.begin(); it!=mp.end(); it++) {
if(it->second !=0) {
printf("-1\n");
return 0;
}
}
if(b[n+1]!=a[n+1]) ans++;
Discrete();
// for(int i=1; i<=n+1; i++) cout <<c[i]<<" ";
// cout <<endl;
// for(int i=1; i<=n+1; i++) cout <<c2[i]<<" ";
// cout <<endl;
int flag=1;
vector<int> n1,n2;
for(int i=1; i<=n+1; i++) {
if(c[i]==c2[i]) continue;
if(flag && c[n+1]==c2[i]) ans++,flag=0;
n1.push_back(c[i]); n2.push_back(c2[i]);
}
for(int i=0; i<n1.size(); i++) fa[n1[i]]=n1[i];
for(int i=0; i<n1.size(); i++) Unionn(n1[i], n2[i]);
// for(int i=0; i<n1.size(); i++) cout<<n1[i]<<": "<<fa[n1[i]]<<endl;
int cnt=0,local[100005];
// memset(ig,0,sizeof(ig));
for(int i=0; i<n1.size(); i++){
if(fa[n1[i]]==n1[i] && !local[n1[i]]) {
local[n1[i]]=1;
cnt++;
}
}
unique(n1.begin(), n1.end());
int gg=0;
for (int i=n1.begin();i<=n1.end();++i) ++gg;
// cout <<gg<<" "<<ans<<" "<<cnt<<endl;
printf("%d\n", gg-ans+cnt);
return 0;
}
| a.cc: In function 'int main()':
a.cc:98:11: warning: ignoring return value of '_FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]', declared with attribute 'nodiscard' [-Wunused-result]
98 | unique(n1.begin(), n1.end());
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:891:5: note: declared here
891 | unique(_ForwardIterator __first, _ForwardIterator __last)
| ^~~~~~
a.cc:100:24: error: cannot convert 'std::vector<int>::iterator' to 'int' in initialization
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ~~~~~~~~^~
| |
| std::vector<int>::iterator
a.cc:100:28: error: no match for 'operator<=' (operand types are 'int' and 'std::vector<int>::iterator')
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ~^~~~~~~~~~
| | |
| int std::vector<int>::iterator
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1154:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1154 | operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1154:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1260: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>&)'
1260 | operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1260:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1353: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>&)'
1353 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1353:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1427:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1427 | operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1427:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: 'std::vector<int>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1521:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1521 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1521:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1599:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1599 | operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1599:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: 'std::vector<int>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1699:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1699 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1699:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1064 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
469 | operator<=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
513 | operator<=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1704 | operator<=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1767 | operator<=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
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:717:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
717 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:717:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/string_view:724: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> >)'
724 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:724:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/string_view:732:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Trait |
s765663360 | p03690 | C++ | #include <bits/stdc++.h>
#define ll long long
using namespace std;
struct node {
int x,id;
}ord[100005],ord2[100005];
int n,flag;
int fa[100005],a[100005],b[100005],c[100005],c2[100005],vis[100005],v[100005];
map<int,int> mp;
bool cmp(node a, node b) {
return a.x<b.x;
}
int Find(int x){
if(fa[x]!=x) fa[x]=Find(fa[x]);
return fa[x];
}
void Unionn(int x,int y) {
x=Find(x); y=Find(y);
fa[x]=y;
}
void Discrete(){
int cnt=1;
sort(ord+1, ord+2+n, cmp);
c[ord[1].id]=cnt++;
for(int i=2; i<=n+1; i++) {
if(ord[i].x==ord[i-1].x) cnt--;
c[ord[i].id]=cnt++;
}
cnt=1;
sort(ord2+1, ord2+2+n, cmp);
c2[ord2[1].id]=cnt++;
for(int i=2; i<=n+1; i++) {
if(ord2[i].x==ord2[i-1].x) cnt--;
c2[ord2[i].id]=cnt++;
}
}
int main(void)
{
int ans=0;
cin >>n;
for(int i=1; i<=n; i++) {
scanf("%d",&a[i]);
ord[i]=(node){a[i],i};
a[n+1]^=a[i];
mp[a[i]]++;
}
mp[a[n+1]]++;
ord[n+1]=(node){a[n+1],n+1};
for(int i=1; i<=n; i++) {
scanf("%d",&b[i]);
ord2[i] =(node){b[i],i};
b[n+1]^=b[i];
mp[b[i]]--;
}
ord2[n+1]=(node){b[n+1],n+1};
mp[b[n+1]]--;
for(map<int,int>::iterator it=mp.begin(); it!=mp.end(); it++) {
if(it->second !=0) {
printf("-1\n");
return 0;
}
}
if(b[n+1]!=a[n+1]) ans++;
Discrete();
// for(int i=1; i<=n+1; i++) cout <<c[i]<<" ";
// cout <<endl;
// for(int i=1; i<=n+1; i++) cout <<c2[i]<<" ";
// cout <<endl;
int flag=1;
vector<int> n1,n2;
for(int i=1; i<=n+1; i++) {
if(c[i]==c2[i]) continue;
if(flag && c[n+1]==c2[i]) ans++,flag=0;
n1.push_back(c[i]); n2.push_back(c2[i]);
}
for(int i=0; i<n1.size(); i++) fa[n1[i]]=n1[i];
for(int i=0; i<n1.size(); i++) Unionn(n1[i], n2[i]);
// for(int i=0; i<n1.size(); i++) cout<<n1[i]<<": "<<fa[n1[i]]<<endl;
int cnt=0,local[100005];
// memset(ig,0,sizeof(ig));
for(int i=0; i<n1.size(); i++){
if(fa[n1[i]]==n1[i] && !local[n1[i]]) {
local[n1[i]]=1;
cnt++;
}
}
unique(n1.begin(), n1.end());
int gg=0;
for (int i=n1.begin();i<=n1.end();++i) ++gg;
// cout <<gg<<" "<<ans<<" "<<cnt<<endl;
printf("%d\n", gg-ans+cnt);
return 0;
}
| a.cc: In function 'int main()':
a.cc:98:11: warning: ignoring return value of '_FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]', declared with attribute 'nodiscard' [-Wunused-result]
98 | unique(n1.begin(), n1.end());
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:891:5: note: declared here
891 | unique(_ForwardIterator __first, _ForwardIterator __last)
| ^~~~~~
a.cc:100:24: error: cannot convert 'std::vector<int>::iterator' to 'int' in initialization
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ~~~~~~~~^~
| |
| std::vector<int>::iterator
a.cc:100:28: error: no match for 'operator<=' (operand types are 'int' and 'std::vector<int>::iterator')
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ~^~~~~~~~~~
| | |
| int std::vector<int>::iterator
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181:
/usr/include/c++/14/bits/regex.h:1154:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1154 | operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1154:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1260: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>&)'
1260 | operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1260:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1353: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>&)'
1353 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1353:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1427:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1427 | operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1427:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: 'std::vector<int>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1521:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1521 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1521:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1599:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1599 | operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1599:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: 'std::vector<int>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/regex.h:1699:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1699 | operator<=(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1699:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1064 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1064:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
469 | operator<=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
513 | operator<=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:513:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1704 | operator<=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1704:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1767 | operator<=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1767:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
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:717:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
717 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:717:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/string_view:724: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> >)'
724 | operator<=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:724:5: note: template argument deduction/substitution failed:
a.cc:100:37: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
100 | for (int i=n1.begin();i<=n1.end();++i) ++gg;
| ^
/usr/include/c++/14/string_view:732:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Trait |
s035869137 | p03690 | C++ | #include<cstdio>
#include<algorithm>
using namespace std;
const int N=100010;
int n,ck=2,suma,sumb,tota,totb,fxor,ans,cnt,f[N],[N],b[N],lsha[N],lshb[N];
int find(int x){
return x==f[x]?x:f[x]=find(f[x]);
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",a+i);
lsha[i]=a[i];
suma^=a[i];
}
for(int i=1;i<=n;i++){
scanf("%d",b+i);
lshb[i]=b[i];
sumb^=b[i];
if(a[i]!=b[i])
ans++;
}
if(!ans){
puts("0");
return 0;
}
++n;
lsha[n]=a[n]=suma,lshb[n]=b[n]=sumb;
sort(lsha+1,lsha+n+1);
sort(lshb+1,lshb+n+1);
for(int i=1;i<=n;i++){
if(lsha[i]!=lshb[i]){
puts("-1");
return 0;
}
}
tota=unique(lsha+1,lsha+n+1)-(lsha+1);
for(int i=1;i<=tota;i++)
f[i]=i;
for(int i=1;i<=n;i++){
int x=lower_bound(lsha+1,lsha+tota+1,a[i])-lsha,y=lower_bound(lsha+1,lsha+tota+1,b[i])-lsha;
int fx=find(x),fy=find(y);
if(fx!=fy)
f[fx]=fy;
}
fxor=find(lower_bound(lsha+1,lsha+n+1,suma)-lsha);
for(int i=1;i<=n;i++){
int fi=find(i);
if(i==fi&&a[i]!=b[i])
cnt++;
if(fi==fxor)
ck--;
}
printf("%d",ans+max(ck,0)+max(cnt-1,0));
return 0;
} | a.cc:5:50: error: expected unqualified-id before '[' token
5 | int n,ck=2,suma,sumb,tota,totb,fxor,ans,cnt,f[N],[N],b[N],lsha[N],lshb[N];
| ^
a.cc: In function 'int main()':
a.cc:12:28: error: 'a' was not declared in this scope
12 | scanf("%d",a+i);
| ^
a.cc:13:17: error: 'lsha' was not declared in this scope
13 | lsha[i]=a[i];
| ^~~~
a.cc:17:28: error: 'b' was not declared in this scope
17 | scanf("%d",b+i);
| ^
a.cc:18:17: error: 'lshb' was not declared in this scope
18 | lshb[i]=b[i];
| ^~~~
a.cc:20:20: error: 'a' was not declared in this scope
20 | if(a[i]!=b[i])
| ^
a.cc:28:9: error: 'lsha' was not declared in this scope
28 | lsha[n]=a[n]=suma,lshb[n]=b[n]=sumb;
| ^~~~
a.cc:28:17: error: 'a' was not declared in this scope
28 | lsha[n]=a[n]=suma,lshb[n]=b[n]=sumb;
| ^
a.cc:28:27: error: 'lshb' was not declared in this scope
28 | lsha[n]=a[n]=suma,lshb[n]=b[n]=sumb;
| ^~~~
a.cc:28:35: error: 'b' was not declared in this scope
28 | lsha[n]=a[n]=suma,lshb[n]=b[n]=sumb;
| ^
a.cc:42:40: error: 'y' was not declared in this scope; did you mean 'fy'?
42 | int fx=find(x),fy=find(y);
| ^
| fy
|
s423994909 | p03690 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#define inf 0x3f3f3f3f
using namespace std;
namespace SETS {
int fa[100005];
void init(int n) {
for(int i=1;i<=n;i++) fa[i]=i;
}
int find_father(int x) {
return (fa[x]==x)?x:fa[x]=find_father(fa[x]);
}
void merge(int x,int y) {
x=find_father(x);y=find_father(y);
if (x==y) return;
fa[x]=y;
}
}
int a[100005],b[100005];
vector <int> vt1[200005],vt2[200005];
int calc(int n,int m) {
SETS::init(n);
for(int i=1;i<=m;i++) {
vt1[i].clear();
vt2[i].clear();
}
for(int i=1;i<=n;i++) {
vt1[a[i]].push_back(i);
vt2[b[i]].push_back(i);
}
for(int i=1;i<=m;i++) {
for(int j=0;j<vt1[i].size();j++) SETS::merge(vt1[i][j],vt2[i][j]);
for(int j=1;j<vt1[i].size();j++) SETS::merge(vt1[i][j],vt1[i][j-1]);
}
int ans=0;
for(int i=1;i<=n;i++)
if (SETS::find_father(i)==i) ans++;
return n+ans;
}
int num[200005],num2[100005],num3[100005];
int cnt1[200005],cnt2[200005];
int main() {
int n,s=0;
scanf("%d",&n);
for(int i=1;i<=n;i++) {
scanf("%d",&a[i]);
num[i]=a[i];
s^=a[i];
}
for(int i=1;i<=n;i++) {
scanf("%d",&b[i]);
num[n+i]=b[i];
}
int m=2*n;
sort(num+1,num+m+1);
int fir=s;
s=lower_bound(num+1,num+m+1,s)-num;
if (num[s]!=fir) s=0;
int pp=0;
for(int i=1;i<=n;i++)
if (a[i]!=b[i]) {
pp++;
num2[pp]=lower_bound(num+1,num+m+1,a[i])-num;
num3[pp]=lower_bound(num+1,num+m+1,b[i])-num;
}
n=pp;
for(int i=1;i<=n;i++) {
a[i]=num2[i];
b[i]=num3[i];
cnt1[a[i]]++;
cnt2[b[i]]++;
}
int diff=0;
for(int i=1;i<=m;i++)
if (cnt1[i]!=cnt2[i]) diff+=abs(cnt1[i]-cnt2[i]);
int ans=inf;
if (!diff) ans=min(ans,calc(n,m));
if (diff==2) {
int p=0;
for(int i=1;i<=n;i++)
if (cnt1[a[i]]>cnt2[a[i]]) p=a[i];
for(int i=1;i<=n;i++)
if (b[i]==s&&cnt2[b[i]]>cnt1[b[i]]) {
swap(b[i],p);
ans=min(ans,calc(n,m)-1);
swap(b[i],p);
break;
}
}
if (!diff) {
for(int i=1;i<=n;i++)
if (s==b[i]) {
ans=min(ans,calc(n,m)-1);
break;
}
}
printf("%d\n",(ans<inf)?ans:-1);
return 0;
} | a.cc:29:1: error: 'vector' does not name a type
29 | vector <int> vt1[200005],vt2[200005];
| ^~~~~~
a.cc: In function 'int calc(int, int)':
a.cc:34:9: error: 'vt1' was not declared in this scope
34 | vt1[i].clear();
| ^~~
a.cc:35:9: error: 'vt2' was not declared in this scope
35 | vt2[i].clear();
| ^~~
a.cc:38:9: error: 'vt1' was not declared in this scope
38 | vt1[a[i]].push_back(i);
| ^~~
a.cc:39:9: error: 'vt2' was not declared in this scope
39 | vt2[b[i]].push_back(i);
| ^~~
a.cc:42:23: error: 'vt1' was not declared in this scope
42 | for(int j=0;j<vt1[i].size();j++) SETS::merge(vt1[i][j],vt2[i][j]);
| ^~~
a.cc:42:64: error: 'vt2' was not declared in this scope
42 | for(int j=0;j<vt1[i].size();j++) SETS::merge(vt1[i][j],vt2[i][j]);
| ^~~
a.cc:43:23: error: 'vt1' was not declared in this scope
43 | for(int j=1;j<vt1[i].size();j++) SETS::merge(vt1[i][j],vt1[i][j-1]);
| ^~~
|
s010851599 | p03690 | C++ | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#include <cstring>
#include <cstdlib>
#include <cctype>
#define fo(i, x, y) for (int i = x; i <= y; ++i)
#define fd(i, x, y) for (int i = x; i >= y; --i)
using namespace std;
const int maxn = 1e5 + 5;
int n, cnt, ans;
int a[maxn], b[maxn], tmpa[maxn], tmpb[maxn], fa[maxn], rank[maxn];
map<int, int> mp;
int getint() {
char ch;
int res = 0, p;
while (!isdigit(ch = getchar()) && ch != '-');
p = ch == '-'? ch = getchar(), -1 : 1;
while (isdigit(ch))
res = res * 10 + ch - '0' , ch = getchar();
return res * p;
}
int getfa(int x) {
return fa[x]? fa[x] = getfa(fa[x]) : x;
}
void un(int x, int y) {
int fx = getfa(x), fy = getfa(y);
if (fx == fy) return;
if (rank[fx] < rank[fy]) fa[fx] = fy;
else fa[fy] = fx, rank[fy] += rank[fx] == rank[fy];
}
int main() {
//freopen("duliu.in", "r", stdin);
//freopen("duliu.out", "w", stdout);
n = getint();
fo (i, 1, n) tmpa[i] = a[i] = getint(), a[0] ^= a[i];
fo (i, 1, n) tmpb[i] = b[i] = getint(), b[0] ^= b[i];
tmpa[0] = a[0]; tmpb[0] = b[0];
sort(tmpa, tmpa + 1 + n);
sort(tmpb, tmpb + 1 + n);
fo (i, 0, n)
if (tmpa[i] != tmpb[i]) {
printf("-1\n");
return 0;
}
if (!mp[a[0]]) mp[a[0]] = ++cnt;
if (!mp[b[0]]) mp[b[0]] = ++cnt;
fo (i, 1, n)
if (a[i] != b[i]) {
ans++;
if (!mp[a[i]]) mp[a[i]] = ++cnt;
if (!mp[b[i]]) mp[b[i]] = ++cnt;
}
fo (i, 1, n)
if (a[i] != b[i]) un(mp[a[i]], mp[b[i]]);
fo (i, 1, cnt)
if (!fa[i]) ans++;
ans--;
printf("%d\n", ans);
return 0;
} | a.cc: In function 'void un(int, int)':
a.cc:37:13: error: reference to 'rank' is ambiguous
37 | if (rank[fx] < rank[fy]) fa[fx] = fy;
| ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
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:2:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:17:57: note: 'int rank [100005]'
17 | int a[maxn], b[maxn], tmpa[maxn], tmpb[maxn], fa[maxn], rank[maxn];
| ^~~~
a.cc:37:24: error: reference to 'rank' is ambiguous
37 | if (rank[fx] < rank[fy]) fa[fx] = fy;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:17:57: note: 'int rank [100005]'
17 | int a[maxn], b[maxn], tmpa[maxn], tmpb[maxn], fa[maxn], rank[maxn];
| ^~~~
a.cc:38:35: error: reference to 'rank' is ambiguous
38 | else fa[fy] = fx, rank[fy] += rank[fx] == rank[fy];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:17:57: note: 'int rank [100005]'
17 | int a[maxn], b[maxn], tmpa[maxn], tmpb[maxn], fa[maxn], rank[maxn];
| ^~~~
a.cc:38:47: error: reference to 'rank' is ambiguous
38 | else fa[fy] = fx, rank[fy] += rank[fx] == rank[fy];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:17:57: note: 'int rank [100005]'
17 | int a[maxn], b[maxn], tmpa[maxn], tmpb[maxn], fa[maxn], rank[maxn];
| ^~~~
a.cc:38:59: error: reference to 'rank' is ambiguous
38 | else fa[fy] = fx, rank[fy] += rank[fx] == rank[fy];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:17:57: note: 'int rank [100005]'
17 | int a[maxn], b[maxn], tmpa[maxn], tmpb[maxn], fa[maxn], rank[maxn];
| ^~~~
|
s198024264 | p03690 | C++ | #include<iostream>
#include<stdio.h>
#include<string.h>
#include<map>
#include<set>
using namespace std;
struct node{
int x,y;
node(int _x,int _y){x=_x,y=_y;}
};
operator <(node x,node y){
if(x.x==y.x)return x.y<y.y;
return x.x<y.x;
}
set<node>s;
int n,a[120000],b[120000];
int x;
map<int,int>p;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]),x^=a[i],p[a[i]]++;
p[x]++;
for(int i=1;i<=n;i++)scanf("%d",&b[i]),p[b[i]]--;
for(int i=1;i<=n;i++)if(p[b[i]]<0){printf("-1\n");return 0;}
for(int i=1;i<=n;i++)if(a[i]!=b[i])s.insert(node(b[i],a[i]));//,printf("%d %d\n",b[i],a[i]);
int ans=0;
// printf("%d\n",s.size());
while(!s.empty()){
set<node>::iterator it=s.lower_bound(node(x,-1));
if(it==s.end())it=s.begin();
node o=*it;
s.erase(it);
swap(x,o.y);
ans++;
if(o.x!=o.y)s.insert(o);
}
printf("%d\n",ans);
} | a.cc:11:1: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
11 | operator <(node x,node y){
| ^~~~~~~~
|
s436576263 | p03690 | C++ | #include<iostream>
#include<stdio.h>
#include<string.h>
#include<map>
#include<set>
using namespace std;
struct node{
int x,y;
node(int _x,int _y){x=_x,y=_y;}
};
inline operator <(node x,node y){
if(x.x==y.x)return x.y<y.y;
return x.x<y.x;
}
set<node>s;
int n,a[120000],b[120000];
int x;
map<int,int>p;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]),x^=a[i],p[a[i]]++;
p[x]++;
for(int i=1;i<=n;i++)scanf("%d",&b[i]),p[b[i]]--;
for(int i=1;i<=n;i++)if(p[b[i]]<0){printf("-1\n");return 0;}
for(int i=1;i<=n;i++)if(a[i]!=b[i])s.insert(node(b[i],a[i]));//,printf("%d %d\n",b[i],a[i]);
int ans=0;
// printf("%d\n",s.size());
while(!s.empty()){
set<node>::iterator it=s.lower_bound(node(x,-1));
if(it==s.end())it=s.begin();
node o=*it;
s.erase(it);
swap(x,o.y);
ans++;
if(o.x!=o.y)s.insert(o);
}
printf("%d\n",ans);
} | a.cc:11:8: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
11 | inline operator <(node x,node y){
| ^~~~~~~~
|
s355610857 | p03690 | C++ | #include<bits/stdc++.h>
const int MAXN = 2e5 + 10;
using namespace std;
int n;
int ans=0,sum=0;
int A[MAXN], B[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, Do[MAXN], fa[MAXN];
int find(int x) {
return fa[x] == x ? fa[x] : fa[x] = find(fa[x]);
}
int unionn(int x, int y) {
fa[x] = y;
}
int main() {
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&A[i]),sa^=A[i];A[n+1]=sa;
for(int i=1;i<=n;i++)scanf("%d",&B[i]),sb^=B[i];B[n+1]=sb;
memcpy(ta,A,sizeof(A));memcpy(tb,B,sizeof(B));
n++;sort(ta+1,ta+n+1);sort(tb+1,tb+n+1);
for(int i=1;i<n;i++)if(ta[i]!=tb[i])return puts("-1"), 0;
for(int i=1;i<=n;i++)
if(A[i]!=B[i]||(i==n)){
Do[++sum]=A[i];
Do[++sum]=B[i];
if(i<n)ans++;
}
if(ans==0)return puts("0"), 0;
sort(Do+1,Do+sum+1);
sum=unique(Do+1,Do+sum+1)-Do-1;
for(int i=1;i<=sum;i++)fa[i]=i;
for(int i=1;i<=n;i++)
if(A[i]!=B[i]) {
A[i]=A[i]-Do;
B[i]=B[i]-Do;
unionn(find(A[i]),find(B[i]));
}
for(int i=1;i<=sum;i++)ans+=(fa[i]==i);
printf("%d",ans-1);
} | a.cc: In function 'int unionn(int, int)':
a.cc:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
12 | }
| ^
a.cc: In function 'int main()':
a.cc:32:22: error: invalid operands of types 'int' and 'int [200010]' to binary 'operator-'
32 | A[i]=A[i]-Do;
| ~~~~^~~
| | |
| | int [200010]
| int
a.cc:33:22: error: invalid operands of types 'int' and 'int [200010]' to binary 'operator-'
33 | B[i]=B[i]-Do;
| ~~~~^~~
| | |
| | int [200010]
| int
|
s851738363 | p03690 | C++ | #include<bits/stdc++.h>
const int MAXN = 4e5 + 10;
using namespace std;
int n;
int A[MAXN], B[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
int find(int x) {
return fa[x] == x ? fa[x] : fa[x] = find(fa[x]);
}
int unionn(int x, int y) {
fa[x] = y;
}
int main() {
scanf("%d",&n);
for(int i = 1; i <= n; i++)scanf("%d",&A[i]), sa ^= A[i]; A[n + 1] = sa;
for(int i = 1; i <= n; i++)scanf("%d",&B[i]);sb ^= B[i]; B[n + 1] = sb;
n++;
memcpy(ta, A, sizeof(A)); memcpy(tb, B, sizeof(B));
sort(ta + 1, ta + n + 1); sort(tb + 1, tb + n + 1);
for(int i = 1; i <= n - 1; i++) if(ta[i] != tb[i]) return puts("-1"), 0;
int ans = 0, sum = 0;
for(int i = 1; i <= n; i++)
if(A[i] != B[i] || (i == n)) {
date[++sum] = A[i]; date[++sum] = B[i];
if(i < n)ans++;
}
if(ans == 0) return puts("0"), 0;
sort(date + 1, date + sum + 1);
sum = unique(date + 1, date + sum + 1) - date - 1;
for(int i = 1; i <= sum; i++) fa[i] = i;
for(int i = 1; i <= n; i++)
if(A[i] != B[i]) {
A[i] = lower_bound(date + 1, date + sum + 1, A[i]) - date;
B[i] = lower_bound(date + 1, date + sum + 1, B[i]) - date;
unionn(find(A[i]), find(B[i]));
}
for(int i = 1; i <= sum; i++)
if(fa[i] == i) ans++;
printf("%d", ans - 1);
return 0;
} | a.cc: In function 'int unionn(int, int)':
a.cc:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
11 | }
| ^
a.cc: In function 'int main()':
a.cc:15:58: error: 'i' was not declared in this scope
15 | for(int i = 1; i <= n; i++)scanf("%d",&B[i]);sb ^= B[i]; B[n + 1] = sb;
| ^
|
s078834976 | p03690 | C++ | }
for (int i = 1; i <= n; i ++) tar[n+1] ^= tar[i];
if (tar[n+1] != ori[n+1]) ans -= 2;
for (int i = 1; i <= n+1; i ++)
{
a[i] = id[ori[i]];
b[i] = id[tar[i]];
vec[b[i]].push_back(i);
}
for (int i = 1; i <= kind; i ++)
{
// printf("kind %d:\n", i);
for (int j = 0; j < vec[i].size(); j ++)
{
// printf("%d ", vec[i][j]);
if (j > 0) unite(vec[i][j-1], vec[i][j]);
}
// printf("\n");
}
}
int main()
{
n = in();
for (int i = 1; i <= n; i ++)
{
tot[i] = ori[i] = in();
xsum ^= ori[i];
}
ori[n+1] = tot[n + 1] = xsum;
for (int i = 1; i <= n; i ++) tar[i] = in();
// /*
if (judge() == false)
{
printf("-1");
return 0;
}
init();
for (int i = 1; i <= n+1; i ++)
if (a[i] == b[i]) vis[i] = true;
else ans ++;
for (int i = 1; i <= n+1; i ++)
{
unite(i, vec[a[i]][0]);
}
for (int i = 1; i <= n+1; i ++)
{
if (vis[i]) continue;
if (fa[i] == i)
{
ans ++;
// printf("[%d]\n", i);
}
}
cout << ans << endl;
// */
return 0;
}
/*
5
4 1 3 4 2
1 4 2 3 4
6
233 2333 666 233 1234 888 (3117)
666 3117 233 233 888 2333 (1234)
6
233 2333 666 888 1234 233
666 3117 233 233 888 2333
*/
| a.cc:1:5: error: expected declaration before '}' token
1 | }
| ^
a.cc:2:9: error: expected unqualified-id before 'for'
2 | for (int i = 1; i <= n; i ++) tar[n+1] ^= tar[i];
| ^~~
a.cc:2:25: error: 'i' does not name a type
2 | for (int i = 1; i <= n; i ++) tar[n+1] ^= tar[i];
| ^
a.cc:2:33: error: 'i' does not name a type
2 | for (int i = 1; i <= n; i ++) tar[n+1] ^= tar[i];
| ^
a.cc:3:9: error: expected unqualified-id before 'if'
3 | if (tar[n+1] != ori[n+1]) ans -= 2;
| ^~
a.cc:4:5: error: expected unqualified-id before 'for'
4 | for (int i = 1; i <= n+1; i ++)
| ^~~
a.cc:4:21: error: 'i' does not name a type
4 | for (int i = 1; i <= n+1; i ++)
| ^
a.cc:4:31: error: 'i' does not name a type
4 | for (int i = 1; i <= n+1; i ++)
| ^
a.cc:10:9: error: expected unqualified-id before 'for'
10 | for (int i = 1; i <= kind; i ++)
| ^~~
a.cc:10:25: error: 'i' does not name a type
10 | for (int i = 1; i <= kind; i ++)
| ^
a.cc:10:36: error: 'i' does not name a type
10 | for (int i = 1; i <= kind; i ++)
| ^
a.cc:20:1: error: expected declaration before '}' token
20 | }
| ^
a.cc: In function 'int main()':
a.cc:23:9: error: 'n' was not declared in this scope
23 | n = in();
| ^
a.cc:23:13: error: 'in' was not declared in this scope; did you mean 'int'?
23 | n = in();
| ^~
| int
a.cc:26:9: error: 'tot' was not declared in this scope
26 | tot[i] = ori[i] = in();
| ^~~
a.cc:26:18: error: 'ori' was not declared in this scope
26 | tot[i] = ori[i] = in();
| ^~~
a.cc:27:9: error: 'xsum' was not declared in this scope
27 | xsum ^= ori[i];
| ^~~~
a.cc:29:5: error: 'ori' was not declared in this scope
29 | ori[n+1] = tot[n + 1] = xsum;
| ^~~
a.cc:29:16: error: 'tot' was not declared in this scope
29 | ori[n+1] = tot[n + 1] = xsum;
| ^~~
a.cc:29:29: error: 'xsum' was not declared in this scope
29 | ori[n+1] = tot[n + 1] = xsum;
| ^~~~
a.cc:30:39: error: 'tar' was not declared in this scope
30 | for (int i = 1; i <= n; i ++) tar[i] = in();
| ^~~
a.cc:32:9: error: 'judge' was not declared in this scope
32 | if (judge() == false)
| ^~~~~
a.cc:34:9: error: 'printf' was not declared in this scope
34 | printf("-1");
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | }
a.cc:37:5: error: 'init' was not declared in this scope; did you mean 'int'?
37 | init();
| ^~~~
| int
a.cc:39:13: error: 'a' was not declared in this scope
39 | if (a[i] == b[i]) vis[i] = true;
| ^
a.cc:39:21: error: 'b' was not declared in this scope
39 | if (a[i] == b[i]) vis[i] = true;
| ^
a.cc:39:27: error: 'vis' was not declared in this scope
39 | if (a[i] == b[i]) vis[i] = true;
| ^~~
a.cc:40:22: error: 'ans' was not declared in this scope
40 | else ans ++;
| ^~~
a.cc:43:26: error: 'vec' was not declared in this scope
43 | unite(i, vec[a[i]][0]);
| ^~~
a.cc:43:30: error: 'a' was not declared in this scope
43 | unite(i, vec[a[i]][0]);
| ^
a.cc:43:17: error: 'unite' was not declared in this scope
43 | unite(i, vec[a[i]][0]);
| ^~~~~
a.cc:47:13: error: 'vis' was not declared in this scope
47 | if (vis[i]) continue;
| ^~~
a.cc:48:13: error: 'fa' was not declared in this scope
48 | if (fa[i] == i)
| ^~
a.cc:50:25: error: 'ans' was not declared in this scope
50 | ans ++;
| ^~~
a.cc:54:5: error: 'cout' was not declared in this scope
54 | cout << ans << endl;
| ^~~~
a.cc:54:13: error: 'ans' was not declared in this scope
54 | cout << ans << endl;
| ^~~
a.cc:54:20: error: 'endl' was not declared in this scope
54 | cout << ans << endl;
| ^~~~
|
s242284468 | p03690 | C++ | // duliu
#include <cstdio>
#include <map>
#include <set>
#define fir first
#define sec second
#define ONLINE_JUDGE
typedef std::set<int> MySt;
typedef std::map<int, MySt> MyMp;
const int MAXN = 1e5 + 10;
int N, val[MAXN], vis[MAXN];
MyMp org_pos;
namespace FastIO {
template <typename T>
void read(T & x) {
x = 0; register char ch = getchar();
for (; ch < '0' || ch > '9'; ch = getchar());
for (; ch >= '0' && ch <= '9'; x = (x << 3) + (x << 1) + (ch ^ '0'), ch = getchar());
}
}
int main() {
#ifndef ONLINE_JUDGE
freopen("duliu.in", "r", stdin);
freopen("duliu.out", "w", stdout);
#endif
using FastIO::read;
read(N);
int _xor = 0;// duliu
#include <cstdio>
#include <map>
#include <set>
#define fir first
#define sec second
// #define ONLINE_JUDGE
typedef std::set<int> MySt;
typedef std::map<int, MySt> MyMp;
const int MAXN = 1e5 + 10;
int N, val[MAXN], vis[MAXN];
MyMp org_pos;
namespace FastIO {
template <typename T>
void read(T & x) {
x = 0; register char ch = getchar();
for (; ch < '0' || ch > '9'; ch = getchar());
for (; ch >= '0' && ch <= '9'; x = (x << 3) + (x << 1) + (ch ^ '0'), ch = getchar());
}
}
int main() {
#ifndef ONLINE_JUDGE
freopen("duliu.in", "r", stdin);
freopen("duliu.out", "w", stdout);
#endif
using FastIO::read;
read(N);
int _xor = 0;
for (int i = 1, vali; i <= N; i++) {
read(vali);
org_pos[vali].insert(i);
_xor ^= vali;
}
org_pos[_xor].insert(0);
for (int i = 1; i <= N; i++) {
read(val[i]);
MyMp::iterator it = org_pos.find(val[i]);
if (it == org_pos.end() || it->sec.empty()) {
puts("-1");
#ifndef ONLINE_JUDGE
fclose(stdin); fclose(stdout);
#endif
return 0;
}
MySt::iterator itt = it->sec.find(i);
if (itt != it->sec.end()) vis[i] = 1, it->sec.erase(itt);
}
int ans = 0;
vis[0] = 1;
for (int i = 1, tag = 2; i <= N; ++tag, i++) {
if (vis[i]) continue;
int step = 0, j;
for (j = i; !vis[j]; ++step) {
if (org_pos[val[j]].empty()) {
puts("-1");
#ifndef ONLINE_JUDGE
fclose(stdin); fclose(stdout);
#endif
return 0;
}
vis[j] = tag;
int tmp = *org_pos[val[j]].begin();
org_pos[val[j]].erase(org_pos[val[j]].begin());
j = tmp;
}
if (vis[j] == tag) ++step;
ans += step;
}
printf("%d\n", ans);
#ifndef ONLINE_JUDGE
fclose(stdin); fclose(stdout);
#endif
return 0;
}
for (int i = 1, vali; i <= N; i++) {
read(vali);
org_pos[vali].insert(i);
_xor ^= vali;
}
org_pos[_xor].insert(0);
for (int i = 1; i <= N; i++) {
read(val[i]);
MyMp::iterator it = org_pos.find(val[i]);
if (it == org_pos.end() || it->sec.empty()) {
puts("-1");
#ifndef ONLINE_JUDGE
fclose(stdin); fclose(stdout);
#endif
return 0;
}
MySt::iterator itt = it->sec.find(i);
if (itt != it->sec.end()) vis[i] = 1, it->sec.erase(itt);
}
int ans = 0;
vis[0] = 1;
for (int i = 1, tag = 2; i <= N; ++tag, i++) {
if (vis[i]) continue;
int step = 0, j;
for (j = i; !vis[j]; ++step) {
if (org_pos[val[j]].empty()) {
puts("-1");
#ifndef ONLINE_JUDGE
fclose(stdin); fclose(stdout);
#endif
return 0;
}
vis[j] = tag;
int tmp = *org_pos[val[j]].begin();
org_pos[val[j]].erase(org_pos[val[j]].begin());
j = tmp;
}
if (vis[j] == tag) ++step;
ans += step;
}
printf("%d\n", ans);
#ifndef ONLINE_JUDGE
fclose(stdin); fclose(stdout);
#endif
return 0;
} | a.cc: In function 'void FastIO::read(T&)':
a.cc:21:46: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
21 | x = 0; register char ch = getchar();
| ^~
a.cc: In function 'int main()':
a.cc:51:1: error: 'namespace' definition is not allowed here
51 | namespace FastIO {
| ^~~~~~~~~
a.cc:60:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
60 | int main() {
| ^~
a.cc:60:9: note: remove parentheses to default-initialize a variable
60 | int main() {
| ^~
| --
a.cc:60:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:60:12: error: a function-definition is not allowed here before '{' token
60 | int main() {
| ^
a.cc: In instantiation of 'void FastIO::read(T&) [with T = int]':
a.cc:33:6: required from here
33 | read(N);
| ~~~~^~~
a.cc:21:46: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
21 | x = 0; register char ch = getchar();
| ^~
|
s677861255 | p03690 | C++ | package main
import (
"bufio"
"fmt"
"io/ioutil"
"os"
)
type IOTp struct {
iBuffer []byte
iPos int
}
func (this *IOTp) GetChar() byte {
res:=this.iBuffer[this.iPos]
this.iPos++
return res
}
func (this *IOTp) ReadInt() int {
res:=0
k:=1
for ch:=this.iBuffer[this.iPos]; !(ch>='0' && ch<='9'); ch=this.iBuffer[this.iPos]{
if ch=='-' {
k=-1
}
this.iPos++
}
for ch:=this.iBuffer[this.iPos]; ch>='0' && ch<='9'; ch=this.iBuffer[this.iPos]{
res=res*10+int(ch-'0')
this.iPos++
}
res*=k
return res
}
func NewIOTp() *IOTp {
now:=new(IOTp)
inputFile,_:=os.Open("in.txt")
//inputFile:=os.Stdin
now.iBuffer,_=ioutil.ReadAll(inputFile)
now.iBuffer=append(now.iBuffer, '\n')
now.iPos=0
return now
}
var cin *bufio.Reader
var cout *bufio.Writer
const MAXN=100000
func main() {
IO:=NewIOTp()
cout=bufio.NewWriter(os.Stdout)
n:=IO.ReadInt()
var a,b [MAXN+10]int
for i:=1; i<=n; i++ {
a[i]=IO.ReadInt()
}
for i:=1; i<=n; i++ {
b[i]=IO.ReadInt()
}
for _,v:=range a[1:n+1] {
a[n+1]^=v
}
for _,v:=range b[1:n+1] {
b[n+1]^=v
}
m:=make(map[int]int)
for _,v:=range a[1:n+2] {
m[v]++
}
for _,v:=range b[1:n+2] {
m[v]--
}
for _,v:=range m {
if v!=0 {
fmt.Println(-1)
return;
}
}
ans:=0
for i:=range a[1:n+2] {
if a[i]!=b[i] {
ans++
}
}
if a[n+1]==b[n+1] && ans!=0 {
ans++
}
fmt.Println(ans)
cout.Flush()
}
| a.cc:1:1: error: 'package' does not name a type
1 | package main
| ^~~~~~~
a.cc:14:6: error: expected constructor, destructor, or type conversion before '(' token
14 | func (this *IOTp) GetChar() byte {
| ^
a.cc:19:6: error: expected constructor, destructor, or type conversion before '(' token
19 | func (this *IOTp) ReadInt() int {
| ^
a.cc:35:1: error: 'func' does not name a type
35 | func NewIOTp() *IOTp {
| ^~~~
a.cc:44:1: error: 'var' does not name a type
44 | var cin *bufio.Reader
| ^~~
|
s952902369 | p03690 | C++ | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define ll long long
#define FOR(i,a) for(ll i=0;i<(ll)a.size();i++)
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll>
using namespace :: std;
const ll maxn=1e5+500;
const ll inf=1e9;
ll a[maxn];
ll b[maxn];
multiset<ll> st;
map<ll,vector<ll> > ger;
map<ll,bool> vis;
void dfs(ll a){
vis[a]=1;
FOR(i,ger[a]){
ll v=ger[a][i];
if(vis[v]==0){
dfs(v);
}
}
}
int main(){
ll n;
cin>>n;
for(ll i=0;i<n;i++){
cin>>a[i];
a[n]^=a[i];
st.insert(a[i]);
}
st.insert(a[n]);
for(ll i=0;i<n;i++){
cin>>b[i];
if(st.find(b[i])==st.end()){
cout<<-1;
return 0;
}
st.erase(st.find(b[i]));
}
b[n]=(*st.begin());
ll ans=-2;
for(ll i=0;i<=n;i++){
if(a[i]!=b[i]){
ger[a[i]].pb(b[i]);
ger[b[i]].pb(a[i]);
}
ans+=(a[i]!=b[i]);
}
for(ll i=0;i<=n;i++){
if(a[i]!=b[i] && vis[a[i]]==0){
dfs(a[i]);
ans++;
}
}
if(b[n]==a[n])ans++;
ans=max(ans,(ll)0);
cout<<ans-1;
| a.cc: In function 'int main()':
a.cc:120:21: error: expected '}' at end of input
120 | cout<<ans-1;
| ^
a.cc:86:11: note: to match this '{'
86 | int main(){
| ^
|
s230371645 | p03690 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,a[100010],a1[100010],b[100010],b1[100010];
int ans=-1,fa[100010],h[19260827],p[19260827],cnt;
inline int hash(int x)
{
int y=x%19260817;
while(h[y]>=0&&h[y]!=x)y=(y+1)%19260817;
return y;
}
inline int f(int x)
{
if(fa[x]!=x)fa[x]=f(fa[x]);
return fa[x];
}
int main()
{
scanf("%d",&n);
for(int i=1; i<=n; i++)
{
scanf("%d",&a[i]);
a1[i]=a[i];
a[n+1]^=a[i];
}
a1[n+1]=a[n+1];
for(int i=1; i<=n; i++)
{
scanf("%d",&b[i]);
b1[i]=b[i];
b[n+1]^=b[i];
}
b1[n+1]=b[n+1];
sort(a1+1,a1+n+2);
sort(b1+1,b1+n+2);
for(int i=1; i<=n+1; i++)
{
if(a1[i]^b1[i])
{
printf("-1");
return 0;
}
}
memset(h,-1,sizeof(h));
for(int i=1; i<=n+1; i++)
{
if(i==n+1||a[i]^b[i])
{
if(i<=n)ans++;
int k=hash(a[i]);
if(h[k]==-1)h[k]=a[i],p[k]=++cnt;
k=hash(b[i]);
if(h[k]==-1)h[k]=b[i],p[k]=++cnt;
}
}
for(int i=1; i<=cnt; i++)fa[i]=i;
for(int i=1; i<=n+1; i++)
{
if(a[i]^b[i])
{
fa[f(p[hash(a[i])])]=f(p[hash(b[i])]);
}
}
for(int i=1; i<=cnt; i++)if(fa[i]==i)ans++;
printf("%d",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:54:31: error: reference to 'hash' is ambiguous
54 | int k=hash(a[i]);
| ^~~~
In file included from /usr/include/c++/14/string_view:50,
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,
from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:8:12: note: 'int hash(int)'
8 | inline int hash(int x)
| ^~~~
a.cc:56:27: error: reference to 'hash' is ambiguous
56 | k=hash(b[i]);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:8:12: note: 'int hash(int)'
8 | inline int hash(int x)
| ^~~~
a.cc:65:32: error: reference to 'hash' is ambiguous
65 | fa[f(p[hash(a[i])])]=f(p[hash(b[i])]);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:8:12: note: 'int hash(int)'
8 | inline int hash(int x)
| ^~~~
a.cc:65:50: error: reference to 'hash' is ambiguous
65 | fa[f(p[hash(a[i])])]=f(p[hash(b[i])]);
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:8:12: note: 'int hash(int)'
8 | inline int hash(int x)
| ^~~~
|
s775524802 | p03690 | C++ | 5
1 1 1 1 0
0 0 1 1 1
3 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 5
| ^
|
s100507795 | p03690 | C++ | #include <iostream>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
int N, A[100005], B[100005], s = 0;
map <int, int> M;
vector <int> V[100005];
set <int> S;
int ind;
int A2[100005], B2[100005];
bool check()
{
sort(A2 + 1, A2 + N + 1);
sort(B2 + 1, B2 + N + 1);
for(int i = 1; i <= N; i++)
if(A2[i] != B2[i])
return 0;
return 1;
}
void Read()
{
cin >> N;
for(int i = 2; i <= N + 1; i++)
cin >> A[i], A[1] = (A[1] ^ A[i]);
for(int i = 2; i <= N + 1; i++)
cin >> B[i], s = (s ^ B[i]);
B[1] = s;
++N;
for(int i = 1; i <= N; i++)
{
A2[i] = A[i];
B2[i] = B[i];
if(M.find(B[i]) == M.end())
{
M[B[i]] = ++ind;
}
int pos = M[B[i]];
if(A[i] != B[i] && i > 1)
V[pos].push_back(i);
}
for(int i = 1; i <= ind; i++)
if(V[i].size() > 0)
S.insert(i);
for(int i = 1; i <= N; i++)
{
A[i] = M[A[i]];
B[i] = M[B[i]];
}
}
void Solve()
{
int ans = 0;
while(!S.empty())
{
if(V[A[1]].size() > 0)
{
int pos = V[A[1]].back();
ans++;
V[A[1]].pop_back();
if(V[A[1]].size() == 0)
S.erase(A[1]);
swap(A[1], A[pos]);
}
else
{
int last = *prev(S.end());
int pos = V[last].back();
ans++;
swap(A[1], A[pos]);
}
}
cout << ans << "\n";
}
int main()
{
Read();
if(check() == 0)
{
cout << "-1\n";
return 0;
}
Solve();
return 0;
}
| a.cc:8:1: error: 'vector' does not name a type
8 | vector <int> V[100005];
| ^~~~~~
a.cc: In function 'void Read()':
a.cc:40:13: error: 'V' was not declared in this scope
40 | V[pos].push_back(i);
| ^
a.cc:43:12: error: 'V' was not declared in this scope
43 | if(V[i].size() > 0)
| ^
a.cc: In function 'void Solve()':
a.cc:57:12: error: 'V' was not declared in this scope
57 | if(V[A[1]].size() > 0)
| ^
|
s625245106 | p03690 | C++ | import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
long[] a = new long[N];
long[] b = new long[N];
for(int i=0;i<N;++i)a[i] =scan.nextLong();
for(int i=0;i<N;++i)b[i] =scan.nextLong();
Map<Long,Integer> countmap = new HashMap<>();
long x = 0;
for(int i=0;i<N;++i)x^=a[i];
countmap.put(x,1);
for(int i=0;i<N;++i){
if(!countmap.containsKey(a[i]))countmap.put(a[i],0);
countmap.put(a[i], countmap.get(a[i])+1);
}
for(int i=0;i<N;++i){
if(!countmap.containsKey(b[i]) || countmap.get(b[i])==0){
System.out.println(-1);
return;
}
countmap.put(b[i], countmap.get(b[i])-1);
}
Map<Long, Deque<Integer>> bNumToIndex = new HashMap<>();
for(int i=0;i<N;++i){
if(!bNumToIndex.containsKey(b[i]))bNumToIndex.put(b[i],new ArrayDeque<>());
bNumToIndex.get(b[i]).add(i);
}
int ans =0;
boolean used[] = new boolean[N];
int index=0;
while(true){
int nextIndex=-1;
if(bNumToIndex.containsKey(x)){
nextIndex=bNumToIndex.get(x).poll();
while(used[nextIndex] && !bNumToIndex.get(x).isEmpty()){
nextIndex = bNumToIndex.get(x).poll();
}
if(bNumToIndex.get(x).isEmpty())bNumToIndex.remove(x);
if(used[nextIndex])nextIndex=-1;
}
if(nextIndex<0){
while(index<N &&(used[index] || a[index]==b[index]))++index;
if(index>=N)break;
nextIndex=index;
++ans;
}
used[nextIndex]=true;
if(x!=a[nextIndex]){
++ans;
x=a[nextIndex];
};
}
System.out.println(ans);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.ArrayDeque;
| ^~~~~~
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.ArrayList;
| ^~~~~~
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.Deque;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.util.HashMap;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.List;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.util.Map;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.Scanner;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.util.Set;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:11: error: expected ':' before 'static'
11 | public static void main(String[] args){
| ^~~~~~~
| :
a.cc:11:29: error: 'String' has not been declared
11 | public static void main(String[] args){
| ^~~~~~
a.cc:11:38: error: expected ',' or '...' before 'args'
11 | public static void main(String[] args){
| ^~~~
a.cc:68:2: error: expected ';' after class definition
68 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:12:9: error: 'Scanner' was not declared in this scope
12 | Scanner scan = new Scanner(System.in);
| ^~~~~~~
a.cc:13:17: error: 'scan' was not declared in this scope
13 | int N = scan.nextInt();
| ^~~~
a.cc:14:13: error: structured binding declaration cannot have type 'long int'
14 | long[] a = new long[N];
| ^~
a.cc:14:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:14:13: error: empty structured binding declaration
a.cc:14:16: error: expected initializer before 'a'
14 | long[] a = new long[N];
| ^
a.cc:15:13: error: structured binding declaration cannot have type 'long int'
15 | long[] b = new long[N];
| ^~
a.cc:15:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:15:13: error: empty structured binding declaration
a.cc:15:16: error: expected initializer before 'b'
15 | long[] b = new long[N];
| ^
a.cc:16:29: error: 'a' was not declared in this scope
16 | for(int i=0;i<N;++i)a[i] =scan.nextLong();
| ^
a.cc:17:29: error: 'b' was not declared in this scope
17 | for(int i=0;i<N;++i)b[i] =scan.nextLong();
| ^
a.cc:18:9: error: 'Map' was not declared in this scope
18 | Map<Long,Integer> countmap = new HashMap<>();
| ^~~
a.cc:18:13: error: 'Long' was not declared in this scope; did you mean 'long'?
18 | Map<Long,Integer> countmap = new HashMap<>();
| ^~~~
| long
a.cc:18:18: error: 'Integer' was not declared in this scope
18 | Map<Long,Integer> countmap = new HashMap<>();
| ^~~~~~~
a.cc:18:27: error: 'countmap' was not declared in this scope
18 | Map<Long,Integer> countmap = new HashMap<>();
| ^~~~~~~~
a.cc:18:42: error: 'HashMap' does not name a type
18 | Map<Long,Integer> countmap = new HashMap<>();
| ^~~~~~~
a.cc:18:50: error: expected primary-expression before '>' token
18 | Map<Long,Integer> countmap = new HashMap<>();
| ^
a.cc:18:52: error: expected primary-expression before ')' token
18 | Map<Long,Integer> countmap = new HashMap<>();
| ^
a.cc:20:32: error: 'a' was not declared in this scope
20 | for(int i=0;i<N;++i)x^=a[i];
| ^
a.cc:23:38: error: 'a' was not declared in this scope
23 | if(!countmap.containsKey(a[i]))countmap.put(a[i],0);
| ^
a.cc:24:26: error: 'a' was not declared in this scope
24 | countmap.put(a[i], countmap.get(a[i])+1);
| ^
a.cc:27:38: error: 'b' was not declared in this scope
27 | if(!countmap.containsKey(b[i]) || countmap.get(b[i])==0){
| ^
a.cc:28:17: error: 'System' was not declared in this scope
28 | System.out.println(-1);
| ^~~~~~
a.cc:31:26: error: 'b' was not declared in this scope
31 | countmap.put(b[i], countmap.get(b[i])-1);
| ^
a.cc:33:19: error: 'Deque' was not declared in this scope
33 | Map<Long, Deque<Integer>> bNumToIndex = new HashMap<>();
| ^~~~~
a.cc:33:35: error: 'bNumToIndex' was not declared in this scope
33 | Map<Long, Deque<Integer>> bNumToIndex = new HashMap<>();
| ^~~~~~~~~~~
a.cc:33:53: error: 'HashMap' does not name a type
33 | Map<Long, Deque<Integer>> bNumToIndex = new HashMap<>();
| ^~~~~~~
a.cc:33:61: error: expected primary-expression before '>' token
33 | Map<Long, Deque<Integer>> bNumToIndex = new HashMap<>();
| ^
a.cc:33:63: error: expected primary-expression before ')' token
33 | Map<Long, Deque<Integer>> bNumToIndex = new HashMap<>();
| ^
a.cc:35:41: error: 'b' was not declared in this scope
35 | if(!bNumToIndex.containsKey(b[i]))bNumToIndex.put(b[i],new ArrayDeque<>());
| ^
a.cc:35:72: error: 'ArrayDeque' does not name a type
35 | if(!bNumToIndex.containsKey(b[i]))bNumToIndex.put(b[i],new ArrayDeque<>());
| ^~~~~~~~~~
a.cc:35:83: error: expected primary-expression before '>' token
35 | if(!bNumToIndex.containsKey(b[i]))bNumToIndex.put(b[i],new ArrayDeque<>());
| ^
a.cc:35:85: error: expected primary-expression before ')' token
35 | if(!bNumToIndex.containsKey(b[i]))bNumToIndex.put(b[i],new ArrayDeque<>());
| ^
a.cc:36:29: error: 'b' was not declared in this scope
36 | bNumToIndex.get(b[i]).add(i);
| ^
a.cc:39:9: error: 'boolean' was not declared in this scope; did you mean 'bool'?
39 | boolean used[] = new boolean[N];
| ^~~~~~~
| bool
a.cc:45:23: error: 'used' was not declared in this scope
45 | while(used[nextIndex] && !bNumToIndex.get(x).isEmpty()){
| ^~~~
a.cc:49:20: error: 'used' was not declared in this scope
49 | if(used[nextIndex])nextIndex=-1;
| ^~~~
a.cc:52:34: error: 'used' was not declared in this scope
52 | while(index<N &&(used[index] || a[index]==b[index]))++index;
| ^~~~
a.cc:52:49: error: 'a' was not declared in this scope
52 | while(index<N &&(used[index] || a[index]==b[index]))++index;
| ^
a.cc:52:59: error: 'b' was not declared in this scope
52 | while(index<N &&(used[index] || a[index]==b[index]))++index;
| ^
a.cc:57:13: error: 'used' was not declared in this scope
57 | used[nextIndex]=true;
| ^~~~
a.cc:58:19: error: 'a' was not declared in this scope
58 | if(x!=a[nextIndex]){
| ^
a.cc:64:9: error: 'System' was not declared in this scope
64 | System.out.println(ans);
| ^~~~~~
|
s272830329 | p03690 | C++ | #include<bits/stdc++.h>
#define fo(i,j,l) for(int i=j;i<=l;++i)
#define fd(i,j,l) for(int i=j;i>=l;--i)
using namespace std;
typedef long long ll;
const ll N=11e4;
map<int,int> cha;
int n,m,j,k,l,i,o;
int fa[N],a[N],b[N],aa[N],bb[N],done[N];
inline int gf(int o)
{return fa[o]==o?o:fa[o]=gf(fa[o]);}
int main()
{
cin>>n;
fo(i,1,n)scanf("%d",&a[i]),a[n+1]^=a[i],aa[i]=a[i];
fo(i,1,n)scanf("%d",&b[i]),b[n+1]^=b[i],bb[i]=b[i];
++n; aa[n]=a[n]; bb[n]=b[n];
sort(aa+1,aa+n+1); sort(bb+1,bb+n+1);
fo(i,1,n)if(aa[i]!=bb[i]){
puts("-1"); return 0;
}
int t=0; aa[0]=bb[0]=-1;
fo(i,1,n)t+=(aa[i]!=aa[i-1]),cha[aa[i]]=t;
fo(i,1,t)fa[i]=i;
int ans=-1;
fo(i,1,n)if(i==n||a[i]!=b[i]){
ans+=(i<n);
int x=cha[a[i]],y=cha[b[i]];
fa[gf(x)]=gf(y);
done[x]=done[y]=1;
}
fo(i,1,n)if(gf(i)==i&&done[i])++ans;
cout<<ans<0?0:ans;
} | a.cc: In function 'int main()':
a.cc:37:18: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>' and 'int')
37 | cout<<ans<0?0:ans;
| ~~~~~~~~~^~
| | |
| | int
| std::basic_ostream<char>
a.cc:37:18: note: candidate: 'operator<(int, int)' (built-in)
37 | cout<<ans<0?0:ans;
| ~~~~~~~~~^~
a.cc:37:18: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h: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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
37 | cout<<ans<0?0:ans;
| ^
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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
37 | cout<<ans<0?0:ans;
| ^
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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
37 | cout<<ans<0?0:ans;
| ^
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:37:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
37 | cout<<ans<0?0:ans;
| ^
/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:37:19: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
37 | cout<<ans<0?0:ans;
| ^
|
s850581140 | p03690 | C++ | // use std::ops::{Index, IndexMut};
// use std::cmp::{Ordering, min, max};
// use std::collections::{BinaryHeap, BTreeMap};
// use std::collections::btree_map::Entry::{Occupied, Vacant};
// use std::clone::Clone;
fn getline() -> String{
let mut res = String::new();
std::io::stdin().read_line(&mut res).ok();
res
}
macro_rules! readl {
($t: ty) => {
{
let s = getline();
s.trim().parse::<$t>().unwrap()
}
};
($( $t: ty),+ ) => {
{
let s = getline();
let mut iter = s.trim().split(' ');
($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
}
};
}
macro_rules! readlvec {
($t: ty) => {
{
let s = getline();
let iter = s.trim().split(' ');
iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
}
}
}
macro_rules! mvec {
($v: expr, $s: expr) => {
vec![$v; $s]
};
($v: expr, $s: expr, $($t: expr),*) => {
vec![mvec!($v, $($t),*); $s]
};
}
macro_rules! debug {
($x: expr) => {
println!("{}: {:?}", stringify!($x), $x)
}
}
fn printiter<'a, T>(v: &'a T)
where
&'a T: std::iter::IntoIterator,
<&'a T as std::iter::IntoIterator>::Item: std::fmt::Display {
for (i,e) in v.into_iter().enumerate() {
if i != 0 {
print!(" ");
}
print!("{}", e);
}
println!("");
}
struct UnionFind {
par: Vec<usize>,
rank: Vec<usize>,
cnt: Vec<u32>,
}
impl UnionFind {
fn new(n: usize) -> UnionFind {
let mut vec = vec![0;n];
for i in 0..n {
vec[i] = i;
}
UnionFind {
par : vec,
rank : vec![0;n],
cnt : vec![0;n],
}
}
fn find(&mut self, x: usize) -> usize {
if x == self.par[x] {
x
}else{
let par = self.par[x];
let res = self.find(par);
self.par[x] = res;
res
}
}
fn same(&mut self, a: usize, b: usize) -> bool {
self.find(a) == self.find(b)
}
fn unite(&mut self, a: usize, b: usize){
let apar = self.find(a);
let bpar = self.find(b);
if apar == bpar {
return;
}
if self.rank[apar] > self.rank[bpar] {
self.par[bpar] = apar;
self.cnt[apar] += self.cnt[bpar];
}else{
self.par[apar] = bpar;
self.cnt[bpar] += self.cnt[apar];
if self.rank[apar] == self.rank[bpar] {
self.rank[bpar] += 1;
}
}
}
fn count(&mut self, v: usize) -> u32 {
let par = self.find(v);
self.cnt[par]
}
fn add(&mut self, v: usize, x: u32) {
let par = self.find(v);
self.cnt[par] += 1;
}
}
fn main() {
let n = readl!(usize);
let a = readlvec!(i32);
let b = readlvec!(i32);
let axor = a.iter().fold(0, |sum, &x| sum^x);
let mut acnt = std::collections::HashMap::new();
for &e in &a {
let x = acnt.entry(e).or_insert(0);
*x += 1;
}
{
let x = acnt.entry(axor).or_insert(0);
*x += 1;
}
let mut ex = true;
let mut usea = false;
// let mut cnt = 0;
let mut deg = vec![0; n];
// debug!(acnt);
let mut ff = true;
for i in 0..n {
if a[i] != b[i] {
ff = false;
}
{
// cnt += \1;
if axor == b[i] && !usea {
usea = true;
}
let x = acnt.entry(b[i]).or_insert(0);
if *x == 0 {
ex = false;
break;
}
*x -= 1;
}
}
// debug!(acnt);
if !ex {
println!("-1");
return;
} else if ff {
println!("0");
return;
}
use std::collections::HashSet;
let mut za = a.clone();
za.push(axor);
za.sort();
za.dedup();
// debug!(za);
let mut uf = UnionFind::new(za.len());
for (&a, &b) in a.iter().zip(b.iter()) {
if a == b {
continue;
}
let ap = za.binary_search(&a).unwrap();
let bp = za.binary_search(&b).unwrap();
// debug!(ap); debug!(bp);
uf.unite(ap, bp);
uf.add(ap, 1);
}
uf.add(za.binary_search(&axor).unwrap(), 1);
// debug!(uf.cnt);
let mut used = vec![false; za.len()];
let mut ans = 0;
for i in 0..za.len() {
let par = uf.find(i);
// debug!(par);
if !used[par] {
used[par] = true;
let num = uf.count(i);
// debug!(num);
if num > 1 {
ans += num+1;
}
}
// debug!(ans);
}
if usea {
println!("{}", ans-2);
} else {
println!("{}", ans);
}
}
| a.cc:54:14: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
54 | fn printiter<'a, T>(v: &'a T)
| ^~~~~~~~~~~~~
a.cc:56:6: warning: missing terminating ' character
56 | &'a T: std::iter::IntoIterator,
| ^
a.cc:56:6: error: missing terminating ' character
56 | &'a T: std::iter::IntoIterator,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:57:7: warning: missing terminating ' character
57 | <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display {
| ^
a.cc:57:7: error: missing terminating ' character
57 | <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:76:18: error: too many decimal points in number
76 | for i in 0..n {
| ^~~~
a.cc:150:14: error: too many decimal points in number
150 | for i in 0..n {
| ^~~~
a.cc:199:14: error: too many decimal points in number
199 | for i in 0..za.len() {
| ^~~~~~~~~
a.cc:7:1: error: 'fn' does not name a type
7 | fn getline() -> String{
| ^~
a.cc:13:1: error: 'macro_rules' does not name a type
13 | macro_rules! readl {
| ^~~~~~~~~~~
a.cc:29:1: error: 'macro_rules' does not name a type
29 | macro_rules! readlvec {
| ^~~~~~~~~~~
a.cc:39:1: error: 'macro_rules' does not name a type
39 | macro_rules! mvec {
| ^~~~~~~~~~~
a.cc:48:1: error: 'macro_rules' does not name a type
48 | macro_rules! debug {
| ^~~~~~~~~~~
a.cc:54:1: error: 'fn' does not name a type
54 | fn printiter<'a, T>(v: &'a T)
| ^~
a.cc:64:5: error: 'println' does not name a type
64 | println!("");
| ^~~~~~~
a.cc:65:1: error: expected declaration before '}' token
65 | }
| ^
a.cc:68:5: error: 'par' does not name a type
68 | par: Vec<usize>,
| ^~~
a.cc:73:6: error: expected initializer before 'UnionFind'
73 | impl UnionFind {
| ^~~~~~~~~
a.cc:130:1: error: 'fn' does not name a type
130 | fn main() {
| ^~
|
s881202009 | p03690 | C++ | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
struct UF {
vector<int> par, rank, sz;
void init(int n){
par = rank = vector<int>(n, 0);
sz = vector<int>(n, 1);
for(int i = 0; i < n; i++){
par[i] = i;
}
}
int find(int x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par[x]);
}
}
int size(int x){
return sz[find(x)];
}
void unite(int x, int y){
x = find(x);
y = find(y);
if(x == y) return;
if(rank[x] < rank[y]){
par[x] = y;
sz[y] += sz[x];
}else{
par[y] = par[x];
if(rank[x] == rank[y]) rank[y]++;
sz[x] += sz[y];
}
}
bool same(int x, int y){
return find(x) == find(y);
}
};
map<ll, ll> mk_comp(const vector<P> &x){
map<ll, ll> dc;
vector<ll> y; y.reserve(x.size()*2);
for(auto p: x){
y.pb(p.fst);
y.pb(p.snd);
}
sort(all(y)); UNIQUE(y);
rep(i, y.size()) dc[y[i]] = i;
return dc;
}
int main(){
int n;
cin>>n;
vector<ll> a[2];
rep(i, 2) a[i] = vector<ll>(n+1, 0);
rep(i, 2) rep(j, n) cin>>a[i][j];
rep(i, 2) rep(j, n) a[i][n] ^= a[i][j];
//auto dc = mk_comp(a[0]);
//rep(i, 2) rep(j, n) a[i][j] = dc[a[i][j]];
vector<P> v; v.reserve(n+1);
rep(i, n+1) if(i==n||a[0][i]!=a[1][i]) v.pb(P(a[1][i], a[0][i]));
auto dc = mk_comp(v);
for(auto &p: v) p = P(dc[p.fst], dc[p.snd]);
ll res = v.size();
if(a[0][n]!=a[1][n]) res-=2;
//cerr<<res<<endl;
rep(i, 2) sort(all(a[i]));
if(a[0]!=a[1]){
cout<<-1<<endl;
return 0;
}
//for(auto x: v) cerr<<x.fst<<" "<<x.snd<<endl;
//cerr<<"A"<<endl;
UF uf;
uf.init(dc.size());
for(auto x: v) uf.unite(x.fst, x.snd);
rep(i, dc.size()){
if(uf.find(i)==i) res++;
| a.cc: In function 'int main()':
a.cc:128:41: error: expected '}' at end of input
128 | if(uf.find(i)==i) res++;
| ^
a.cc:127:26: note: to match this '{'
127 | rep(i, dc.size()){
| ^
a.cc:128:41: error: expected '}' at end of input
128 | if(uf.find(i)==i) res++;
| ^
a.cc:96:11: note: to match this '{'
96 | int main(){
| ^
|
s625471856 | p03690 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
int a_arr[10001];
int b_arr[10000];
bool b_chk[100000];
bool a_sort(const pair<unsigned int, unsigned int>&x, const pair<unsigned int, unsigned int>&y)
{
if (x.first < y.first) return true;
if (x.first > y.first) return false;
return x.second < y.second;
}
int main(void) {
int N;
cin >> N;
vector <pair<unsigned int, unsigned int>> a, b;
unsigned int n;
unsigned int xor = 0;
for (int i = 0; i < N; i++) {
cin >> n;
xor ^= n;
a.push_back(make_pair(n, i));
a_arr[i] = n;
}
for (int i = 0; i < N; i++) {
cin >> n;
b.push_back(make_pair(n, i));
b_arr[i] = n;
}
int diff_cnt = 0;
for (int i = a.size()-1; i >= 0; i--) {
if (a[i].first != b[i].first) diff_cnt++;
else {
a.erase(a.begin()+i);
b.erase(b.begin()+i);
}
}
a.push_back(make_pair(xor, N));
a_arr[N] = xor;
std::sort(a.begin(), a.end(), a_sort);
std::sort(b.begin(), b.end());
bool use_xor = false;
int a_xor_vec_pos = -1;
int a_replace_vec_pos = -1;
unsigned int b_vec_pos = 0;
for (unsigned int a_vec_pos = 0; (a_vec_pos < a.size()) && (b_vec_pos < b.size()); a_vec_pos++) {
if (a[a_vec_pos].second == N) a_xor_vec_pos = a_vec_pos;
if (b[b_vec_pos].first==a[a_vec_pos].first) {
if (b[b_vec_pos].first == xor) use_xor = true;
b_arr[b[b_vec_pos].second] = b_vec_pos;
b[b_vec_pos].second = a_vec_pos;
b_vec_pos++;
} else {
a[a_vec_pos].second = -1;
a_replace_vec_pos = a_vec_pos;
}
}
if (use_xor) {
a[a_replace_vec_pos].second = a_xor_vec_pos;
}
if (b_vec_pos == b.size()) {
for (unsigned int b_pos = 0; b_pos < b.size(); b_pos++) {
b_chk[b_pos] = false;
}
int b_chk_cnt = 0;
int add_cnt = 0;
for (unsigned int i = 0; i < b.size() && b_chk_cnt < b.size(); i++) {
int b_pos = i;
if(b_chk[b_pos]) continue;
add_cnt++;
while (!b_chk[b_pos]) {
b_chk[b_pos] = true;
b_chk_cnt++;
int a_vec_pos = b[b_pos].second;
int ary_pos = a[a_vec_pos].second;
b_pos = b_arr[ary_pos];
}
}
if(use_xor) add_cnt--;
cout << add_cnt + b_chk_cnt << endl;
} else {
cout << -1 << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:22: error: expected unqualified-id before 'xor' token
25 | unsigned int xor = 0;
| ^~~
a.cc:28:17: error: expected primary-expression before 'xor' token
28 | xor ^= n;
| ^~~
a.cc:28:21: error: expected primary-expression before '^=' token
28 | xor ^= n;
| ^~
a.cc:48:31: error: expected primary-expression before 'xor' token
48 | a.push_back(make_pair(xor, N));
| ^~~
a.cc:48:34: error: expected primary-expression before ',' token
48 | a.push_back(make_pair(xor, N));
| ^
a.cc:49:20: error: expected primary-expression before 'xor' token
49 | a_arr[N] = xor;
| ^~~
a.cc:49:23: error: expected primary-expression before ';' token
49 | a_arr[N] = xor;
| ^
a.cc:60:51: error: expected primary-expression before 'xor' token
60 | if (b[b_vec_pos].first == xor) use_xor = true;
| ^~~
a.cc:60:54: error: expected primary-expression before ')' token
60 | if (b[b_vec_pos].first == xor) use_xor = true;
| ^
|
s472515462 | p03690 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N;
vector<int> a(N + 1):
vector<int> b(N + 1);
vector<int> c(N + 1);
vector<int> d(N + 1);
for (int i = 0; i < N; i++){
cin >> a[i];
c[i] = a[i];
}
for (int i = 0; i < N; i++){
cin >> b[i];
d[i] = b[i];
}
int x = 0;
int y = 0;
for (int i = 0; i < N; i++){
x ^= a[i];
}
for (int i = 0; i < N; i++){
y ^= b[i];
}
c[N] = x;
d[N] = y;
sort(c.begin(), c.end());
sort(d.begin(), d.end());
for (int i = 0; i < N + 1; i++){
if (c[i] != d[i]){
cout << -1 << endl;
return 0;
}
}
int ans = N;
for (int i = 0; i < N; i++){
if (a[i] == b[i]){
ans--;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:6:29: error: expected ',' or ';' before ':' token
6 | vector<int> a(N + 1):
| ^
a.cc:15:22: error: 'b' was not declared in this scope
15 | cin >> b[i];
| ^
a.cc:24:22: error: 'b' was not declared in this scope
24 | y ^= b[i];
| ^
a.cc:38:27: error: 'b' was not declared in this scope
38 | if (a[i] == b[i]){
| ^
|
s616545345 | p03690 | Java | import javafx.concurrent.Task;
import java.io.*;
import java.util.*;
/**
* Created by tela on 2017/06/18.
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskD solver = new TaskD();
solver.solve(in, out);
out.close();
}
static class TaskD {
public void solve(InputReader in, PrintWriter out) {
int N = in.nextInt();
int[] a = new int[N];
for(int i =0; i<N;i++){
a[i] = in.nextInt();
}
int[] b = new int[N];
for(int i =0; i<N;i++){
b[i] = in.nextInt();
}
int count = 0;
while(true){
boolean cflag = true;
for(int i=0; i<N; i++) {
if (a[i] != b[i]) {
cflag = false;
}
}
if(cflag){
out.println(count);
break;
}
int x = 0;
for(int i=0;i<N;i++){
x=x^a[i];
}
int flag = -1;
for(int i =0; i<N;i++){
if(x==b[i]){
flag = i;
}
}
if(flag == -1){
out.println("-1");
break;
}
// out.println("f "+flag+" a "+a[0]+a[1]+a[2]+" b "+b[0]+b[1]+b[2]);
// //change
a[flag] = b[flag];
count+=1;
}
}
}
//input
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
} | Main.java:1: error: package javafx.concurrent does not exist
import javafx.concurrent.Task;
^
1 error
|
s321665180 | p03690 | C++ | #include <bits/stdc++.h>
using namespace std;
const int MaxN = 100003;
int n,a[MaxN],b[MaxN];
int t1[MaxN],t2[MaxN];
int fa[MaxN],rank[MaxN];
bool vis[MaxN];
int getfa(int x) {
if (x!=fa[x]) fa[x]=getfa(fa[x]);
return fa[x];
}
void uni(int a,int b) {
a=getfa(a),b=getfa(b);
if (a!=b) {
if (rank[a]<rank[b]) {
fa[a]=b;
rank[b]+=a;
} else {
fa[b]=a;
rank[a]+=b;
}
}
}
int main() {
scanf("%d",&n);
for (int i=1;i<=n;++i) scanf("%d",a+i);
for (int i=1;i<=n;++i) scanf("%d",b+i);
for (int i=0;i<=n;++i) a[0]^=a[i],b[0]^=b[i];
for (int i=0;i<=n;++i) t1[i]=a[i],t2[i]=b[i];
sort(t1,t1+n+1),sort(t2,t2+n+1);
for (int i=0;i<=n;++i)
if (t1[i]!=t2[i]) {
puts("-1");
return 0;
}
int* ed=unique(t1,t1+n+1);
for (int i=0;i<=n;++i) a[i]=lower_bound(t1,ed,a[i])-t1,b[i]=lower_bound(t1,ed,b[i])-t1;
for (int i=0;i<=n;++i) fa[i]=i,rank[i]=1;
int ans=0;
for (int i=1;i<=n;++i)
if (a[i]==b[i]) a[i]=b[i]=-1;
else {
uni(a[i],b[i]);
ans++;
}
if (ans==0) {
puts("0");
return 0;
}
for (int i=1;i<=n;++i) if (a[i]!=-1 && !vis[getfa(a[i])]) ans++,vis[getfa(a[i])]=true;
if (vis[getfa(a[0])]) ans--;
printf("%d\n",ans);
return 0;
} | a.cc: In function 'void uni(int, int)':
a.cc:16:21: error: reference to 'rank' is ambiguous
16 | if (rank[a]<rank[b]) {
| ^~~~
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/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:14: note: 'int rank [100003]'
7 | int fa[MaxN],rank[MaxN];
| ^~~~
a.cc:16:29: error: reference to 'rank' is ambiguous
16 | if (rank[a]<rank[b]) {
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:14: note: 'int rank [100003]'
7 | int fa[MaxN],rank[MaxN];
| ^~~~
a.cc:18:25: error: reference to 'rank' is ambiguous
18 | rank[b]+=a;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:14: note: 'int rank [100003]'
7 | int fa[MaxN],rank[MaxN];
| ^~~~
a.cc:21:25: error: reference to 'rank' is ambiguous
21 | rank[a]+=b;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:14: note: 'int rank [100003]'
7 | int fa[MaxN],rank[MaxN];
| ^~~~
a.cc: In function 'int main()':
a.cc:40:40: error: reference to 'rank' is ambiguous
40 | for (int i=0;i<=n;++i) fa[i]=i,rank[i]=1;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:14: note: 'int rank [100003]'
7 | int fa[MaxN],rank[MaxN];
| ^~~~
|
s889198709 | p03690 | C++ | #include <bits/stdc++.h>
#define N 100005
using namespace std;
int bb[N],ct,*x[N];
bool cmp(int *a,int *b)
{
return (*a) < (*b);
}
void pppd(int *a,int sz)
{
for(int i = 1; i <= sz; i ++) x[i] = &a[i];
ct = 0;
sort(x + 1, x + sz + 1, cmp);
bb[1] = ++ ct;
for(int i = 2; i <= sz; i ++) bb[i] = *x[i] == *x[i-1] ? bb[i - 1]:++ ct;
for(int i = 1; i <= sz; i ++) *x[i] = bb[i];
}
int n;
int fa[N];
int find(int x)
{
return fa[x] == x? x:fa[x] = find(fa[x]);
}
void union(int x,int y)
{
if(find(x) == find(y)) return;
fa[find(x)] = find(y);
}
int a[N],b[N];
int c[N],d[N],m;
int main()
{
scanf("%d",&n);
int ta = 0, tb = 0;
for(int i = 1; i <= n; i ++) scanf("%d", &a[i]), ta ^= a[i];
for(int i = 1; i <= n; i ++) scanf("%d", &b[i]), tb ^= b[i];
n ++;
a[n] = ta;
b[n] = tb;
for(int i = 1; i <= n; i ++)
if(a[i] != b[i])
c[++ m] = a[i], d[m] = b[i];
int fl1 = 0, fl2 = 0;
if(a[n] == b[n]) fl1 = 1;
for(int i = 1; i <= m; i ++)
if(c[i] == a[n]) fl2 = 1;
sort(a + 1, a + n + 1);
sort(b + 1, b + n + 1);
for(int i = 1; i <= n; i ++)
if(a[i] != b[i])
return puts("-1"), 0;
int ans = 0;
if(fl1 == 1 && fl2 == 1) ans --;
if(fl1 == 0) ans -= 2;
ans += m;
pppd(c,m);
pppd(d,m);
for(int i = 1; i <= m; i ++) fa[i] = i;
for(int i = 1; i <= m; i ++) union(c[i], d[i]);
for(int i = 1; i <= ct; i ++) if(find(i) == i) ans ++;
cout << ans << endl;
return 0;
}
| a.cc:25:11: error: expected identifier before '(' token
25 | void union(int x,int y)
| ^
a.cc:25:12: error: expected unqualified-id before 'int'
25 | void union(int x,int y)
| ^~~
a.cc:25:12: error: expected ')' before 'int'
25 | void union(int x,int y)
| ~^~~
| )
a.cc: In function 'int main()':
a.cc:63:38: error: expected primary-expression before 'union'
63 | for(int i = 1; i <= m; i ++) union(c[i], d[i]);
| ^~~~~
|
s219265663 | p03690 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
#define sz(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
///////////////////
int const N = 2e5 + 41;
int n;
vector<int> a, b, ha, hb;
map<int, int> h, bal;
int x, w[N];
vector<int> e[N];
int ans;
void print(int v){
cout << v << endl;
exit(0);
}
int getHash(int v){
if(h.find(v) == h.end()){
int val = sz(h);
h[v] = val;
}
return h[v];
}
void read(){
cin >> n;
rep(i, 0, n){
int v;
cin >> v;
a.pb(v);
}
rep(i, 0, n){
int v;
cin >> v;
b.pb(v);
}
}
void hashIt(){
rep(i, 0, n) x ^= (a[i]);
getHash(x);
rep(i, 0, n) getHash(a[i]), getHash(b[i]);
}
void checkBad(){
bal[getHash(x)] = 1;
rep(i, 0, n){
++bal[getHash(a[i])];
--bal[getHash(b[i])];
}
rep(i, 0, n){
if(a[i] == b[i]) continue;
ha.pb(getHash(a[i]));
hb.pb(getHash(b[i]));
}
int bad = -1;
for(auto it : bal){
if(it.second != 0){
if(bad != -1) print(-1);
bad = it.first;
}
}
ha.pb(getHash(x));
hb.pb(bad);
}
void pushEdges(){
ans = sz(ha);
rep(i, 0, sz(ha)){
e[ha[i]].pb(hb[i]);
e[hb[i]].pb(ha[i]);
}
}
void dfs(int u){
if(w[u]) return;
w[u] = 1;
for(int to : e[u]) dfs(to);
}
void solve(){
read();
hashIt();
checkBad();
pushEdges();
rep(i, 0, sz(ha)){
if(!w[ha[i]]){
++ans;
dfs(ha[i]);
}
}
cout << print(ans - 2) << endl;
}
int main(){
#ifdef _DEBUG
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:102:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'void')
102 | cout << print(ans - 2) << endl;
| ~~~~ ^~ ~~~~~~~~~~~~~~
| | |
| | void
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'void' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'void' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'void' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'void' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'void' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'void' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'void' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'void' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'void' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'void' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'void' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'void' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'void' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'void' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'void' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'void' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'void' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
| ^~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:124:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
124 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:125:3 |
s497606173 | p03690 | C++ | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
multiset<int> A,B;
int n,a[N],b[N],c[N];
int rank(int x){
int l=0,r=n;
while (l<r){
int mid=(l+r)>>1;
if (c[mid]>=x) r=mid;else l=mid+1;
}
return l;
}
//S[x]表示b中权为x的未匹配的位置
set<int> S[N],T;
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
a[0]^=a[i];
}
for (int i=0;i<=n;i++)
A.insert(a[i]),c[i]=a[i];
for (int i=1;i<=n;i++){
scanf("%d",&b[i]);
b[0]^=b[i];
}
for (int i=0;i<=n;i++)
B.insert(b[i]);
if (A!=B) return puts("-1"),0;
sort(c,c+n+1);
for (int i=0;i<=n;i++){
a[i]=rank(a[i]);
b[i]=rank(b[i]);
if (i&&a[i]!=b[i]){
S[b[i]].insert(i);
T.insert(i);
}
}
int ans=0;
while (!T.empty()){
while (!S[a[0]].empty()){
int p=*S[a[0]].begin();
S[a[0]].erase(p);
T.erase(p);
swap(a[0],a[p]);
ans++;
}
if (T.empty()) break;
int p=*T.begin();
swap(a[0],a[p]);
ans++;
}
/*for (int i=0;i<=n;i++) printf("%d ",a[i]);puts("");
for (int i=0;i<=n;i++) printf("%d ",b[i]);puts("");*/
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:34:22: error: reference to 'rank' is ambiguous
34 | a[i]=rank(a[i]);
| ^~~~
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/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:6:5: note: 'int rank(int)'
6 | int rank(int x){
| ^~~~
a.cc:35:22: error: reference to 'rank' is ambiguous
35 | b[i]=rank(b[i]);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:6:5: note: 'int rank(int)'
6 | int rank(int x){
| ^~~~
|
s004987902 | p03690 | C++ | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <set>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cmath>
#include <deque>
#include <bitset>
#define ll long long
#define PI 3.1415926535897932384626433832795
#define read(x) scanf("%d",&x);
#define readll(x) cin>>x;
#define FOR(x,a,b) for(int x=a;x<b;x++)
#define MP make_pair
#define PB push_back
#define pii pair<int,int>
#define readN(N,X) for(int i=0;i<N;i++) cin>>X[i];
#define pff pair<double,double>
using namespace std;
map<int, queue<int> > to;
int N;
int a[100005];
int b[100005];
int vis[100005];
map<int,int> ca,cb;
void No(){
cout<<"-1"<<endl;
exit(0);
}
int main () {
std::ios::sync_with_stdio(false);
cin>>N;
readN(N,a);
readN(N,b);
FOR(i,0,N){
ca[a[i]]++;
cb[b[i]]++;
//cout<<"dari "<<b[i]<<" ke "<<a[i]<<endl;
}
int res = 0;
int kagi = 0;
FOR(i,0,N) kagi ^= a[i];
FOR (i,0,N){
if (a[i] == b[i]) continue;
to[b[i]].push(i);
}
bool mul = 0;
//cout<<kagi<<endl;
FOR (i,0,N){
if (a[i] != b[i] && b[i] == kagi) {
int p = i;
while (!vis[p]) {
//cout<<p<<endl;
vis[p] = 1;
res++;
if (to[ a[p] ].size() == 0) break;
int tmp = to[ a[p] ].front();
to[ a[p] ].pop();
p =tmp;
}
mul=1;
kagi = a[p];
break;
}
}
//cout<<kagi<<endl;
//cout<<"AA"<<endl;
bool gagal = 0;
FOR(i,0,N){
if (!vis[i] && a[i] != b[i]) gagal=1;
//if () gagal=1;
}
if (!gagal) {
cout<<res<<endl;
return 0;
}
if (mul || to[kagi].size() == 0) res++;
res+=mul;
FOR(i,0,N){
if (a[i] == b[i]) continue;
if (vis[i]) continue;
int p = i;
while (!vis[p]) {
//cout<<p<<endl;
vis[p] = 1;
res++;
if (to[ a[p] ].size() == 0) No();
while (1){
int tmp = to[ a[p] ].front();
to[ a[p] ].pop();
if (!vis[tmp] ||to[ a[p] ].size() == 0 ) break;
}
p =tmp;
}
//cout<<"1loop "<<endl;
res++;
}
cout<<res - 1<<endl;
}
| a.cc: In function 'int main()':
a.cc:108:28: error: 'tmp' was not declared in this scope; did you mean 'tm'?
108 | p =tmp;
| ^~~
| tm
|
s357568590 | p03690 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <multset>
#include <map>
using namespace std;
#define SZ(a) (int)(a).size()
typedef long long ll;
int main() {
cin.sync_with_stdio(false);
int n;
map<int, int> t;
vector<int> a;
int xo = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
a.push_back(x);
xo ^= x;
t[x]++;
}
t[xo]++;
vector<int> b;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
b.push_back(x);
t[x]--;
if (t[x] < 0) {
puts("-1");
return 0;
}
}
map<int, multiset<int>> ab, ba;
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
ab[a[i]].insert(b[i]);
ba[b[i]].insert(a[i]);
}
}
int ans = 0;
while (!ab.empty()) {
int bx;
int ax;
if (ba.find(xo) != end(ba)) {
bx = xo;
ax = *begin(ba[bx]);
}
else {
for (auto it = begin(ab); it != end(ab); ++it) {
if (*it != xo) {
ax = *it;
bx = *begin(ab[ax]);
ab[ax].insert(xo);
ba[xo].insert(ax);
}
}
}
ba[bx].erase(begin(ba[bx]));
if (ba[bx].empty()) {
ba.erase(bx);
}
ab[ax].erase(ab[ax].find(bx));
if (ab[ax].empty()) {
ab.erase(ax);
}
xo = ax;
}
printf("%d\n", ans);
return 0;
}
| a.cc:5:10: fatal error: multset: No such file or directory
5 | #include <multset>
| ^~~~~~~~~
compilation terminated.
|
s410971422 | p03690 | C++ | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
using namespace std;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)
#define pr(x) do{cout << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cout << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x,n) rep(__i,n) pri(x,__i);
#define prar(x,b,e) repr(__i,b,e) pri(x,__i);
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
int in() {
int a;
scanf("%d ", &a);
return a;
}
int main() {
int N = in();
vint a(N+1), b(N+1);
int hoge = 0, fuga = 0;
rep(i,N) hoge ^= a[i] = in();
rep(i,N) fuga ^= b[i] = in();
a[N] = hoge, b[N] = fuga;
vint c = a, d = b;
sort(c.begin(), c.end());
sort(d.begin(), d.end());
rep(i,N+1) {
if (c[i] != d[i]) {
cout << -1 << endl;
return 0;
}
}
map<int, vint*> data;
int siz = 0;
set<int> ind;
rep(i,N) {
if (a[i] == b[i]) continue;
ind.insert(i);
if (data.find(b[i]) == data.end()) {
data[b[i]] = new vint(1,i);
}
else {
data[b[i]]->pb(i);
}
siz++;
}
int ans = 0;
int t = a[N];
for (; siz > 0;) {
ans++;
vint *v = data[t];
if (v && v->size() > 0) {
int j = v->at(v->size() - 1);
v->pop_back();
ind.erase(j);
int temp = a[j];
a[j] = t;
t = temp;
siz--;
}
else {
int j = *(ind.begin());
for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
if (a[*i] == t) continue;
j = *i;
if (a[j] != b[N]) break;
}
int temp = a[j];
a[j] = t;
t = temp;
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:87:63: error: conversion from 'std::set<int>::reverse_iterator' {aka 'std::reverse_iterator<std::_Rb_tree_const_iterator<int> >'} to non-scalar type 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} requested
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ~~~~~~~~~~^~
a.cc:87:69: error: no match for 'operator!=' (operand types are 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} and 'std::set<int>::reverse_iterator' {aka 'std::reverse_iterator<std::_Rb_tree_const_iterator<int> >'})
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ~ ^~ ~~~~~~~~~~
| | |
| | std::set<int>::reverse_iterator {aka std::reverse_iterator<std::_Rb_tree_const_iterator<int> >}
| std::set<int>::iterator {aka std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator}
In file included 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,
from a.cc:3:
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::pair<_T1, _T2>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
455 | operator!=(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::reverse_iterator<_Iterator>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
500 | operator!=(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::reverse_iterator<_Iterator>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1686 | operator!=(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::move_iterator<_IteratorL>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1753 | operator!=(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::move_iterator<_IteratorL>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:4:
/usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)'
197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::fpos<_StateT>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)'
243 | operator!=(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::set<int>::iterator' {aka 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator'} is not derived from 'const std::allocator<_CharT>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++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:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
651 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
/usr/include/c++/14/string_view:658: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> >)'
658 | operator!=(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
/usr/include/c++/14/string_view:666: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>)'
666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed:
a.cc:87:81: note: 'std::reverse_iterator<std::_Rb_tree_const_iterator<int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>'
87 | for (set<int>::iterator i = ind.rbegin(); i != ind.rend(); ++i) {
| ^
/usr/include/c++/14/bits/basic_string.h:3833: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>&)'
3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/ |
s607558512 | p03690 | C++ | #include <cstdio>
#include <cstdlib>
#include <queue>
using namespace std;
const int MAXN = 1e5 + 10;
void Fail(){
printf("-1\n");
exit(0);
}
int n, a[MAXN], b[MAXN], cx;
void floor( int bit ){
cx = 0;
for ( int i = 0; i < n; i++ )
cx ^= a[i];
while ( !q[0].empty() ) q[0].pop();
while ( !q[1].empty() ) q[1].pop();
for ( int i = 0; i < n; i++ )
if ( ( (a[i] ^ b[i]) & bit ) )
q[ !!(b[i] & bit) ].push(i);
while ( true ){
int hq = !!(cx & bit);
if ( q[ !!(cx & bit) ].empty() )
return;
int h = q[hq].front();
q[hq].pop();
int bx = cx;
cx ^= a[h];
a[h] = bx;
cx ^= a[h];
++sol;
}
}
int main(){
scanf("%d", &n);
for ( int i = 0; i < n; i++ )
scanf("%d", a + i);
for ( int i = 0; i < n; i++ )
scanf("%d", b + i);
for ( int i = 0; i < 29; i++ )
floor( 1 << i );
for ( int i = 0; i < n; i++ )
if ( a[i] != b[i] )
Fail();
printf("%d\n", sol);
return 0;
} | a.cc: In function 'void floor(int)':
a.cc:20:18: error: 'q' was not declared in this scope
20 | while ( !q[0].empty() ) q[0].pop();
| ^
a.cc:21:18: error: 'q' was not declared in this scope
21 | while ( !q[1].empty() ) q[1].pop();
| ^
a.cc:25:25: error: 'q' was not declared in this scope
25 | q[ !!(b[i] & bit) ].push(i);
| ^
a.cc:30:22: error: 'q' was not declared in this scope; did you mean 'hq'?
30 | if ( q[ !!(cx & bit) ].empty() )
| ^
| hq
a.cc:33:25: error: 'q' was not declared in this scope
33 | int h = q[hq].front();
| ^
a.cc:40:19: error: 'sol' was not declared in this scope
40 | ++sol;
| ^~~
a.cc: In function 'int main()':
a.cc:59:24: error: 'sol' was not declared in this scope
59 | printf("%d\n", sol);
| ^~~
|
s423396377 | p03690 | C++ | #include <cstdio>
#include <cstdlib>
#include <queue>
using namespace std;
const int MAXN = 1e5 + 10;
void Fail(){
printf("-1\n");
exit(0);
}
int n, a[MAXN], b[MAXN], cx;
void floor( int bit ){
cx = 0;
for ( int i = 0; i < n; i++ )
cx ^= a[i];
while ( !q[0].empty() ) q[0].pop();
while ( !q[1].empty() ) q[1].pop();
for ( int i = 0; i < n; i++ )
if ( ( (a[i] ^ b[i]) & bit ) )
q[ !!(b[i] & bit) ].push(i);
while ( true ){
int hq = !!(cx & bit);
if ( q[ !!(cx & bit) ].empty() )
return;
int h = q[hq].front();
q[hq].pop();
int bx = cx;
cx ^= a[h];
a[h] = bx;
cx ^= a[h];
}
}
int main(){
scanf("%d", &n);
for ( int i = 0; i < n; i++ )
scanf("%d", a + i);
for ( int i = 0; i < n; i++ )
scanf("%d", b + i);
for ( int i = 0; i < 29; i++ )
floor( 1 << i );
for ( int i = 0; i < n; i++ )
if ( a[i] != b[i] )
Fail();
printf("%d\n", sol);
return 0;
} | a.cc: In function 'void floor(int)':
a.cc:20:18: error: 'q' was not declared in this scope
20 | while ( !q[0].empty() ) q[0].pop();
| ^
a.cc:21:18: error: 'q' was not declared in this scope
21 | while ( !q[1].empty() ) q[1].pop();
| ^
a.cc:25:25: error: 'q' was not declared in this scope
25 | q[ !!(b[i] & bit) ].push(i);
| ^
a.cc:30:22: error: 'q' was not declared in this scope; did you mean 'hq'?
30 | if ( q[ !!(cx & bit) ].empty() )
| ^
| hq
a.cc:33:25: error: 'q' was not declared in this scope
33 | int h = q[hq].front();
| ^
a.cc: In function 'int main()':
a.cc:58:24: error: 'sol' was not declared in this scope
58 | printf("%d\n", sol);
| ^~~
|
s959878249 | p03690 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using pii = pair<int, int>;
int main(){
ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n), b(n);
for(int i = 0; i < n; ++i){ cin >> a[i]; }
for(int i = 0; i < n; ++i){ cin >> b[i]; }
int a_sum = 0, b_sum = 0;
for(int i = 0; i < n; ++i){
a_sum ^= a[i];
b_sum ^= b[i];
}
a.push_back(a_sum);
b.push_back(b_sum);
vector<int> c, d;
unordered_multimap<int, int> d_map;
for(int i = 0; i <= n; ++i){
if(a[i] == b[i]){ continue; }
c.push_back(a[i]);
d.push_back(b[i]);
d_map.emplace(d.back(), d.size() - 1);
}
const int m = c.size();
if(m == 0){
cout << 0 << endl;
return 0;
}
vector<int> g(m);
iota(g.begin(), g.end(), 0);
for(int i = 0; i < m; ++i){
if(c[i] == d[i]){ continue; }
int last = c[i];
g[i] = i;
while(d_map.find(last) != d_map.end()){
const auto it = d_map.find(last);
const int t = c[it->second];
c[it->second] = last;
g[it->second] = i;
last = t;
d_map.erase(it);
}
}
if(!d_map.empty()){
cout << -1 << endl;
return 0;
}
vector<vector<int>> h(m);
for(int i = 0; i < m; ++i){
h[g[i]].push_back(c[i]);
}
int answer = m - 1;
unordered_set<int> occ;
for(const auto& v : h){
if(v.empty()){ continue; }
bool found = false;
for(const auto x : v){
if(occ.find(x) != occ.end()){
found = true;
break;
}
}
if(!found){ ++answer; }
for(const auto x : v){ occ.insert(x); }
}
if(a_sum != b_sum){ --answer; }
cout << answer << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:39:9: error: 'iota' was not declared in this scope
39 | iota(g.begin(), g.end(), 0);
| ^~~~
|
s227178724 | p03691 | C++ | /* be name khoda */
// #define long_enable
#include <iostream>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <fstream>
#include <set>
#include <map>
using namespace std;
#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif
typedef pair<ll, ll> pii;
typedef pair<pii, ll> ppi;
typedef pair<ll, pii> pip;
typedef vector<ll> vi;
typedef vector<pii> vpii;
#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define forirto(i, n, e) for (ll i = (n) - 1; i >= e; --i)
#define fori(i, n) forifrom (i, 0, n)
#define forir(i, n) forirto (i, n, 0)
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))
#define debug(x) cout << #x << " -> " << (x) << endl
#define debug2(x, y) cout << #x << ' ' << #y << " -> " << (x) << ' ' << (y) << endl
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> " << (x) << ' ' << (y) << ' ' << (z) << endl
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> " << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << endl
#define debugp(x) cout << #x << " -> " << "(" << (x).F << ", " << (x).S << ")" << endl
#define debuga(x, n) cout << #x << " -> "; fori (i1_da, n) { cout << (x)[i1_da] << ' '; } cout << endl
#define debugap(x, n) cout << #x << " ->\n"; fori (i1_dap, n) { cout << "(" << (x)[i1_dap].F << ", " << (x)[i1_dap].S << ")\n"; } cout << endl
#define debugaa(x, n, m) cout << #x << " ->\n"; fori (i1_daa, n) { fori (i2_daa, m) { cout << (x)[i1_daa][i2_daa] << ' '; } cout << '\n'; } cout << endl
#define debugav(x, n) cout << #x << " ->\n"; fori (i1_dav, n) { fori (i2_dav, (x)[i1_dav].size()) { cout << (x)[i1_dav][i2_dav] << ' '; } cout << '\n'; } cout << endl
#define debugia(x, n) cout << #x << " ->\n"; fori (i1_dia, n) { cout << i1_dia << " : " << (x)[i1_dia] << '\n'; } cout << endl
const ll MOD = 1000000007;
const ll INF = 2000000000;
const long long BIG = 1446803456761533460LL;
#define Add(a, b) a = ((a) + (b)) % MOD
#define Mul(a, b) a = (1LL * (a) * (b)) % MOD
// -----------------------------------------------------------------------
const ll maxn = 410;
const ll maxm = 100010;
const ll maxnlg = 20;
ll n, m;
ll L[maxn][maxn], R[maxn][maxn], q[maxn];
vpii g[maxn];
bool vis[maxn];
int main() {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> m;
fori (i, m) {
ll a, b; cin >> a >> b; --a, --b;
g[a].eb(b, i), g[b].eb(a, i);
es[i] = {a, b};
}
fori (i, n) {
fill(R[i], R[i] + n, m);
L[i][i] = m;
memset(vis, 0, sizeof vis);
ll l = 0, r = 0;
q[r++] = i;
while (l < r) {
ll x = q[l++];
for (auto y : g[x]) {
ll v, e; tie(v, e) = y;
if (e < L[i][x]) {
if (!vis[v]) {
vis[v] = true;
q[r++] = v;
}
smax(L[i][v], e);
smin(R[i][v], e);
}
}
}
}
ll ans = 0;
fori (i, n) {
fori (j, i) {
++ans;
fori (k, n) {
if (min(R[i][k], R[j][k]) < max(L[i][k], L[j][k])) {
--ans;
break;
}
}
}
}
cout << ans << '\n';
}
| a.cc: In function 'int main()':
a.cc:75:9: error: 'es' was not declared in this scope; did you mean 'eb'?
75 | es[i] = {a, b};
| ^~
| eb
|
s516040612 | p03691 | C++ | // IOI 2021
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
////////////////////////////////////////////////////////////////////
const int N = 4e2 + 2, M = 1e5 + 2;
bool M[N];
int X[M], Y[M];
bitset<N> S[N];
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
mt19937 Rnd(time(0));
int n, m, ans = 0; cin >> n >> m;
for (int i = 0; i < n; i++) S[i][i] = 1;
for (int i = 0; i < m; i++) cin >> X[i] >> Y[i], X[i]--, Y[i]--;
while (m--) {
int x = X[m], y = Y[m];
for (int i = 0; i < n; i++) {
if (S[i][x] && S[i][y]) M[i] = true;
else if (S[i][x]) S[i][y] = true;
else if (S[i][y]) S[i][x] = true;
}
}
for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) if (M[i] + M[j] + (S[i] & S[j]).count() == 0) ans++;
cout << ans << endl;
return 0;
}
| a.cc:23:6: error: conflicting declaration 'bool M [402]'
23 | bool M[N];
| ^
a.cc:21:24: note: previous declaration as 'const int M'
21 | const int N = 4e2 + 2, M = 1e5 + 2;
| ^
a.cc: In function 'int main()':
a.cc:38:50: error: invalid types 'const int[int]' for array subscript
38 | if (S[i][x] && S[i][y]) M[i] = true;
| ^
a.cc:43:70: error: invalid types 'const int[int]' for array subscript
43 | for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) if (M[i] + M[j] + (S[i] & S[j]).count() == 0) ans++;
| ^
a.cc:43:77: error: invalid types 'const int[int]' for array subscript
43 | for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) if (M[i] + M[j] + (S[i] & S[j]).count() == 0) ans++;
| ^
|
s268037320 | p03691 | C++ | #include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
using namespace std;
using int64 = long long;
/////////////////////
// Code starts here//
/////////////////////
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N, M;
cin >> N >> M;
vector<bitset<400>> seen(N);
vector<bool> alive(N, true);
for (int i = 0; i < N; i++)
seen[i][i] = 1;
for (int i = 0; i < M; i++) {
int x, y;
cin >> x >> y;
x--, y--;
if ((seen[x] & seen[y]).count()) {
alive[x] = false;
alive[y] = false;
}
if (!alive[y])
alive[x] = false;
if (!alive[x])
alive[y] = false;
seen[x] |= seen[y];
seen[y] |= seen[x];
}
int res = 0;
for (int i = 0; i < N; i++) {
for (int j = i + 1; j < N; j++) {
if (alive[i] && alive[j] && !(seen[i] & seen[j]).count()) {
res++;
}
}
}
cout << res << "\n";
return 0;
}
| a.cc: In function 'int main()':
a.cc:35:12: error: 'bitset' was not declared in this scope
35 | vector<bitset<400>> seen(N);
| ^~~~~~
a.cc:17:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
16 | #include <cassert>
+++ |+#include <bitset>
17 |
a.cc:35:19: error: template argument 1 is invalid
35 | vector<bitset<400>> seen(N);
| ^~~
a.cc:35:19: error: template argument 2 is invalid
a.cc:35:22: error: expected unqualified-id before '>' token
35 | vector<bitset<400>> seen(N);
| ^~
a.cc:39:9: error: 'seen' was not declared in this scope
39 | seen[i][i] = 1;
| ^~~~
a.cc:46:14: error: 'seen' was not declared in this scope
46 | if ((seen[x] & seen[y]).count()) {
| ^~~~
a.cc:56:9: error: 'seen' was not declared in this scope
56 | seen[x] |= seen[y];
| ^~~~
a.cc:64:43: error: 'seen' was not declared in this scope
64 | if (alive[i] && alive[j] && !(seen[i] & seen[j]).count()) {
| ^~~~
|
s165062245 | p03691 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
inline int read()
{
int x = 0, f = 1; char c = getchar();
while (!isdigit(c)) {if (c == '-') f = -1; c = getchar();}
while (isdigit(c)) {x = x * 10 + c - '0', c = getchar();}
return x * f;
}
const int maxn = 405;
typedef bitset<maxn> mybitset;
int n, m, u[maxn * maxn], v[maxn * maxn];
mybitset bit[maxn]; bool mark[maxn];
int main()
{
n = read(), m = read();
for (int i = 1; i <= m; i ++) u[i] = read(), v[i] = read();
for (int i = 1; i <= n; i ++) bit[i].set(i);
for (int i = m; i >= 1; i --)
for (int x = 1; x <= n; x ++) if (!mark[x])
{
if (!bit[x].test(u[i]) && !bit[x].test(v[i])) continue;
if (bit[x].test(u[i]) && bit[x].test(v[i])) {mark[x] = 1; continue;}
if (bit[x].test(u[i])) bit[x].set(v[i]);
else bit[x].set(u[i]);
}
int ans = 0;
for (int i = 1; i <= n; i ++) if (!mark[i])
for (int j = i + 1; j <= n; j ++) if (!mark[j])
ans += (bit[i] & bit[j]).none();
printf("%d\n", ans);
return 0;
} | a.cc:16:9: error: 'bitset' does not name a type
16 | typedef bitset<maxn> mybitset;
| ^~~~~~
a.cc:18:1: error: 'mybitset' does not name a type
18 | mybitset bit[maxn]; bool mark[maxn];
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:24:39: error: 'bit' was not declared in this scope
24 | for (int i = 1; i <= n; i ++) bit[i].set(i);
| ^~~
a.cc:28:30: error: 'bit' was not declared in this scope
28 | if (!bit[x].test(u[i]) && !bit[x].test(v[i])) continue;
| ^~~
a.cc:29:29: error: 'bit' was not declared in this scope
29 | if (bit[x].test(u[i]) && bit[x].test(v[i])) {mark[x] = 1; continue;}
| ^~~
a.cc:30:29: error: 'bit' was not declared in this scope
30 | if (bit[x].test(u[i])) bit[x].set(v[i]);
| ^~~
a.cc:36:33: error: 'bit' was not declared in this scope
36 | ans += (bit[i] & bit[j]).none();
| ^~~
|
s752897532 | p03691 | C++ | // This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
char t=getchar();
bool neg=false;
x=0;
for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
if(x<0)putchar('-'),x=-x;
short a[20]= {},sz=0;
while(x>0)a[sz++]=x%10,x/=10;
if(sz==0)putchar('0');
for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);
int n,m,x[100111],y[100111];
bool kill[411];
bitset<411> a[411];
int main()
{
get2(n,m);
for(int i=1;i<=m;i++)get2(x[i],y[i]);
for(int i=1;i<=n;i++)
{
a[i].set(i);
for(int j=m;j>=1;j--)
{
int s=a[i].test(x[j])+a[i].test(y[j]);
if(s==2)
{
kill[i]=1;
break;
}
else if(s==1)
{
a[i].set(x[j]);
a[i].set(y[j]);
}
}
}
int ans=0;
for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)if(!kill[i]&&!kill[j]&&(a[i]&a[j]).none())ans++;
printendl(ans);
return 0;
} | a.cc:38:14: error: 'bool kill [411]' redeclared as different kind of entity
38 | bool kill[411];
| ^
In file included from /usr/include/c++/14/csignal:42,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
from a.cc:2:
/usr/include/signal.h:112:12: note: previous declaration 'int kill(__pid_t, int)'
112 | extern int kill (__pid_t __pid, int __sig) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:52:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
52 | kill[i]=1;
| ^
a.cc:52:40: error: assignment of read-only location '*(kill + ((sizetype)i))'
52 | kill[i]=1;
| ~~~~~~~^~
a.cc:63:63: warning: pointer to a function used in arithmetic [-Wpointer-arith]
63 | for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)if(!kill[i]&&!kill[j]&&(a[i]&a[j]).none())ans++;
| ^
a.cc:63:73: warning: pointer to a function used in arithmetic [-Wpointer-arith]
63 | for(int i=1;i<=n;i++)for(int j=i+1;j<=n;j++)if(!kill[i]&&!kill[j]&&(a[i]&a[j]).none())ans++;
| ^
|
s360333813 | p03691 | C++ | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
const int N=1e6+5,M=405;
typedef long long ll;
int a[N],b[N];
bool s[M][M];
bool vis[M];
int n,m;
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++)
scanf("%d%d",&a[i],&b[i]);
for(int i=1;i<=n;i++){
s[i][i]=1;
for(int j=m;j>=1;j--){
bool x=box[i][a[j]],y=box[i][b[j]];
if(x&&y)
vis[i]=1;
else if(x)
box[i][b[j]]=1;
else if(y)
box[i][a[j]]=1;
}
}
int ans=0;
for(int i=1;i<=n;i++){
if(vis[i])
continue;
for(int j=i+1;j<=n;j++){
if(vis[j])
continue;
bool flag=true;
for(int k=1;k<=n;k++)
if(s[i][k]&&s[j][k]){
flag=false;
break;
}
ans+=flag;
}
}
printf("%d\n",ans);
}
| a.cc: In function 'int main()':
a.cc:20:20: error: 'box' was not declared in this scope
20 | bool x=box[i][a[j]],y=box[i][b[j]];
| ^~~
a.cc:21:19: error: 'y' was not declared in this scope
21 | if(x&&y)
| ^
|
s732369717 | p03691 | C++ | #pragma GCC optimize(3)
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,s,m,cnt,tcnt,tot,idx[400010],lt[400010],rt[400010],a[100010],u[100010],p[100010],d[100010],vis[1000010],in[1000010],up[1000010];
vector<int>g[1000010];
inline void add_edge(int u,int v){
g[u].push_back(v);
in[v]++;
return;
}
void build(int o,int l,int r){
if(l==r){
idx[o]=l;
return;
}
idx[o]=++cnt;
lt[idx[o]]=l;
rt[idx[o]]=r;
int mid=(l+r)>>1;
build(o<<1,l,mid);
build(o<<1|1,mid+1,r);
add_edge(idx[o],idx[o<<1]);
add_edge(idx[o],idx[o<<1|1]);
return;
}
void link(int o,int l,int r,int L,int R,int u){
if(L<=l&&r<=R){
add_edge(u,idx[o]);
return;
}
int mid=(l+r)>>1;
if(L<=mid)
link(o<<1,l,mid,L,R,u);
if(R>mid)
link(o<<1|1,mid+1,r,L,R,u);
return;
}
inline void bfs(){
queue<int>q;
for(register int i=1;i<=n;i++)
if(!in[i]){
q.push(i);
if(up[i]>1e9)
up[i]=1e9;
vis[i]=1;
}
while(!q.empty()){
int u=q.front();
q.pop();
for(auto &v:g[u]){
if(vis[v]&&((up[v]>=up[u]&&v<=n)||(up[v]>up[u]&&v>n))){
puts("NIE");
exit(0);
}
if(v<=n)
up[v]=min(up[v],up[u]-1);
else
up[v]=min(up[v],up[u]);
in[v]--;
if(!in[v]){
vis[v]=1;
q.push(v);
}
}
}
return;
}
char buffer[10000010],*hd;
inline char Getchar(){
return *hd++;
}
inline int rd(){
register int x=0;
char c;
do c=Getchar();
while(!isdigit(c));
do{
x=(x<<1)+(x<<3)+(c^48);
c=Getchar();
}while(isdigit(c));
return x;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("data.in","r",stdin);
#endif
fread(buffer,1,10000000,stdin);
hd=buffer;
memset(up,127,sizeof(up));
n=rd(),s=rd(),m=rd();
for(register int i=1;i<=s;i++){
p[i]=rd(),d[i]=rd();
up[p[i]]=d[i];
}
cnt=n;
build(1,1,n);
tcnt=cnt;
while(m--){
int l=rd(),r=rd(),k=rd();
++cnt;
for(register int i=1;i<=k;i++){
u[i]=rd();
if(i==1){
if(u[i]>l)
link(1,1,n,l,u[i]-1,cnt);
}
else{
if(u[i]>u[i-1]+1)
link(1,1,n,u[i-1]+1,u[i]-1,cnt);
}
add_edge(u[i],cnt);
}
if(r>u[k])
link(1,1,n,u[k]+1,r,cnt);
}
bfs();
for(register int i=1;i<=n;i++){
if(up[i]<1||!vis[i]){
puts("NIE");
return 0;
}
if(up[i]>1e9)
up[i]=1e9;
}
for(register int i=1;i<=s;i++)
if(up[p[i]]!=d[i]){
puts("NIE");
return 0;
}
puts("TAK");
for(register int i=1;i<=n;i++)
printf("%d ",up[i]);
return 0;
} | a.cc: In function 'void bfs()':
a.cc:43:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
43 | for(register int i=1;i<=n;i++)
| ^
a.cc: In function 'int rd()':
a.cc:76:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
76 | register int x=0;
| ^
a.cc:79:16: error: 'isdigit' was not declared in this scope
79 | while(!isdigit(c));
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:94:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
94 | for(register int i=1;i<=s;i++){
| ^
a.cc:104:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
104 | for(register int i=1;i<=k;i++){
| ^
a.cc:120:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
120 | for(register int i=1;i<=n;i++){
| ^
a.cc:128:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
128 | for(register int i=1;i<=s;i++)
| ^
a.cc:134:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
134 | for(register int i=1;i<=n;i++)
| ^
|
s873325203 | p03691 | C++ | for(int j=0;j<N;j++){
mex[i][j]=mex[j][i]=1;
}
}
}
/*
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
printf("%d",mex[i][j]);
}
printf("\n");
}
*/
int cnt=0;
for(int i=0;i<N;i++){
for(int j=0;j<i;j++){
if(mex[i][j]==0) cnt++;
}
}
printf("%d\n",cnt);
return 0;
}
| a.cc:1:7: error: expected unqualified-id before 'for'
1 | for(int j=0;j<N;j++){
| ^~~
a.cc:1:19: error: 'j' does not name a type
1 | for(int j=0;j<N;j++){
| ^
a.cc:1:23: error: 'j' does not name a type
1 | for(int j=0;j<N;j++){
| ^
a.cc:4:5: error: expected declaration before '}' token
4 | }
| ^
a.cc:5:3: error: expected declaration before '}' token
5 | }
| ^
a.cc:15:3: error: expected unqualified-id before 'for'
15 | for(int i=0;i<N;i++){
| ^~~
a.cc:15:15: error: 'i' does not name a type
15 | for(int i=0;i<N;i++){
| ^
a.cc:15:19: error: 'i' does not name a type
15 | for(int i=0;i<N;i++){
| ^
a.cc:20:9: error: expected constructor, destructor, or type conversion before '(' token
20 | printf("%d\n",cnt);
| ^
a.cc:21:3: error: expected unqualified-id before 'return'
21 | return 0;
| ^~~~~~
a.cc:22:1: error: expected declaration before '}' token
22 | }
| ^
|
s483106545 | p03691 | C++ | /*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
*/
#pragma GCC target("sse4,tune=native")
#pragma GCC optimize("O3","unroll-loops")
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const pair<T, U> &_p) { _out << _p.first << ' ' << _p.second; return _out; }
template<typename T, typename U> inline istream &operator>> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const vector<T> &_v) { if (_v.empty()) { return _out; } _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
template<typename T> inline ostream &operator<< (ostream &_out, const set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T> inline ostream &operator<< (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) { return _out; } _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) { _out << ' ' << *_it; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
template<typename T, typename U> inline ostream &operator<< (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) { return _out; } _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) { _out << ", (" << _it->first << ": " << _it->second << ')'; } return _out; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left228
#define right right228
#define next next228
#define rank rank228
#define prev prev228
#define y1 y1228
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
const string FILENAME = "input";
const int MAXN = 100228;
//13:14
//15:04
int n, m;
int x[MAXN], y[MAXN];
bool inside[MAXN][MAXN];
bool bad[MAXN];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
//read(FILENAME);
cin >> n >> m;
for (int i = 0; i < m; i++) {
cin >> x[i] >> y[i];
}
for (int i = 1; i <= n; i++) {
inside[i][i] = true;
for (int j = m - 1; j >= 0; j--) {
if (inside[i][x[j]] && inside[i][y[j]]) {
bad[i] = true;
break;
}
if (!inside[i][x[j]] && !inside[i][y[j]]) {
continue;
}
if (inside[i][x[j]]) {
inside[i][y[j]] = true;
} else {
inside[i][x[j]] = true;
}
}
}
int ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
if (!bad[i] && !bad[j]) {
bool bads = false;
for (int k = 1; k <= n; k++) {
if (inside[i][k] && inside[j][k]) {
bads = true;
break;
}
}
if (!bads) {
ans++;
}
}
}
}
cout << ans << '\n';
return 0;
}
| In file included from /usr/include/c++/14/string:43,
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:19:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]': target specific option mismatch
182 | ~allocator() _GLIBCXX_NOTHROW { }
| ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:186:14: note: called from here
186 | struct _Alloc_hider : allocator_type // TODO check __is_final
| ^~~~~~~~~~~~
|
s165340905 | p03691 | C++ | #include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<Cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn = 510;
const int maxm = 210000;
int n,m;
struct edge{int x,y;}a[maxm];
bitset<maxn>S[maxn];
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++) scanf("%d%d",&a[i].x,&a[i].y);
for(int i=1;i<=n;i++)
{
S[i][i]=1;
for(int j=m;j>=1;j--)
{
int x=a[j].x,y=a[j].y;
if(S[i][x]&&S[i][y]) { S[i].set(); break; }
if(!S[i][x]&&!S[i][y]) continue;
if(S[i][x]) S[i][y]=1;
else S[i][x]=1;
}
}
int ans=0;
for(int i=1;i<n;i++) for(int j=i+1;j<=n;j++) if((S[i]&S[j]).count()==0)
ans++;
printf("%d\n",ans);
return 0;
}
| a.cc:12:9: fatal error: Cstdlib: No such file or directory
12 | #include<Cstdlib>
| ^~~~~~~~~
compilation terminated.
|
s647558418 | p03691 | C++ | #include <cstdio>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
using namespace std;
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }
int main() {
int n, m; scanf("%d%d", &n, &m);
assert (m < 15);
vector<int> xs(m), ys(m);
repeat (i, m) {
scanf("%d%d", &xs[i], &ys[i]);
-- xs[i];
-- ys[i];
}
auto possible = vectors(n, n, false);
repeat (s, 1 << m) {
vector<bool> alive(n, true);
repeat (i, m) {
int x = xs[i];
int y = ys[i];
if (alive[x] and alive[y]) {
alive[(s & (1 << i)) ? x : y] = false;
} else if (alive[x]) {
alive[x] = false;
} else if (alive[y]) {
alive[y] = false;
}
}
repeat (x, n) if (alive[x]) {
repeat (y, n) if (alive[y]) {
possible[x][y] = true;
}
}
}
int result = 0;
repeat (y, n) repeat (x, y) {
result += possible[x][y];
}
printf("%d\n", result);
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:5: error: 'assert' was not declared in this scope
10 | assert (m < 15);
| ^~~~~~
a.cc:3:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
2 | #include <vector>
+++ |+#include <cassert>
3 | #define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
|
s063358872 | p03692 | C++ | #include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge
#ifdef DONLINE_JUDGE
// palindromic tree is better than splay tree!
#define lld I64d
#endif
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(10);
int N,M;
cin >> N >> M;
vector< vector<int> > G(N);
long long ans =1;
for(int i =0; i < M; i++) {
ans =(ans*2)%mod;
int x,y;
cin >> x >> y;
if(x == 1 && y == 2) continue;
G[N-x].push_back(N-y);}
vector< vector<int> > deg(N,vector<int>(1<<N,0));
for(int i =0; i < N; i++) for(int j =0; j < (1<<N); j++)
ALL_THE(G[i],it) deg[i][j] +=(j>>*it)&1;
vector<long long> cnt(1<<N,0);
cnt[0] =1;
long long mod =1000000007;
for(int i =0; i < (1<<(N-2)); i++) if(cnt[i] != 0) {
vector<int> v;
int w,w2;
for(int j =0; j < N; j++) if(((i>>j)&1) == 0) v.push_back(j);
int sz =v.size();
for(int j =0; j < (1<<(sz-2)); j++) for(int k =0; k < 2; k++) {
w =0;
for(int a =0; a < sz-2; a++) if((j>>a)&1) w +=1<<v[a];
if(k) w +=(1<<(N-2))*3;
if(w == 0) continue;
w2 =(1<<N)-1-i-w;
long long c =1;
for(int a =0; a < N; a++) if((w2>>a)&1) c =(c*((1LL<<deg[a][w])-1))%mod;
for(int a =0; a < N; a++) if((w>>a)&1) c =(c*(1LL<<deg[a][w2]))%mod;
c =(c*cnt[i])%mod;
cnt[i+w] =(cnt[i+w]+c)%mod;}
}
for(int i =0; i < (1<<N); i++) if((i>>(N-1))&1) if((i>>(N-2))&1) {
int e =0;
for(int j =0; j < N; j++) if(((i>>j)&1) == 0)
ALL_THE(G[j],it) if(((i>>*it)&1) == 0) e++;
ans =(ans-(1LL<<e)*cnt[i])%mod;}
if(ans < 0) ans +=mod;
cout << ans << "\n";
return 0;}
// look at my code
// my code is amazing
| a.cc: In function 'int main()':
a.cc:48:30: error: 'mod' was not declared in this scope; did you mean 'modf'?
48 | ans =(ans*2)%mod;
| ^~~
| modf
|
s414126404 | p03692 | C++ | #include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge
#ifdef DONLINE_JUDGE
// palindromic tree is better than splay tree!
#define lld I64d
#endif
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(10);
int N,M;
cin >> N >> M;
vector< vector<int> > G(N);
cat ans =1;
for(int i =0; i < M; i++) {
ans =(ans*2)%mod;
int x,y;
cin >> x >> y;
if(x == 1 && y == 2) continue;
G[N-x].push_back(N-y);}
vector< vector<int> > deg(N,vector<int>(1<<N,0));
for(int i =0; i < N; i++) for(int j =0; j < (1<<N); j++)
ALL_THE(G[i],it) deg[i][j] +=(j>>*it)&1;
vector<long long> cnt(1<<N,0);
cnt[0] =1;
long long mod =1000000007;
for(int i =0; i < (1<<(N-2)); i++) if(cnt[i] != 0) {
vector<int> v;
int w,w2;
for(int j =0; j < N; j++) if(((i>>j)&1) == 0) v.push_back(j);
int sz =v.size();
for(int j =0; j < (1<<(sz-2)); j++) for(int k =0; k < 2; k++) {
w =0;
for(int a =0; a < sz-2; a++) if((j>>a)&1) w +=1<<v[a];
if(k) w +=(1<<(N-2))*3;
if(w == 0) continue;
w2 =(1<<N)-1-i-w;
long long c =1;
for(int a =0; a < N; a++) if((w2>>a)&1) c =(c*((1LL<<deg[a][w])-1))%mod;
for(int a =0; a < N; a++) if((w>>a)&1) c =(c*(1LL<<deg[a][w2]))%mod;
c =(c*cnt[i])%mod;
cnt[i+w] =(cnt[i+w]+c)%mod;}
}
for(int i =0; i < (1<<N); i++) if((i>>(N-1))&1) if((i>>(N-2))&1) {
int e =0;
for(int j =0; j < N; j++) if(((i>>j)&1) == 0)
ALL_THE(G[j],it) if(((i>>*it)&1) == 0) e++;
ans =(ans-(1LL<<e)*cnt[i])%mod;}
if(ans < 0) ans +=mod;
cout << ans << "\n";
return 0;}
// look at my code
// my code is amazing
| a.cc: In function 'int main()':
a.cc:46:9: error: 'cat' was not declared in this scope
46 | cat ans =1;
| ^~~
a.cc:48:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
48 | ans =(ans*2)%mod;
| ^~~
| abs
a.cc:48:30: error: 'mod' was not declared in this scope; did you mean 'modf'?
48 | ans =(ans*2)%mod;
| ^~~
| modf
a.cc:83:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
83 | ans =(ans-(1LL<<e)*cnt[i])%mod;}
| ^~~
| abs
a.cc:84:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
84 | if(ans < 0) ans +=mod;
| ^~~
| abs
a.cc:85:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
85 | cout << ans << "\n";
| ^~~
| abs
|
s266652640 | p03693 | C++ | #include <iostream>
using namespace std;
int main()
{
int r, g, b;
cin >> r >> g >> b;
if ((r*100+g+10+b)%4==0) {
cout << "YES" << endl;
} else {
cout << "NO" endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:17: error: expected ';' before 'endl'
10 | cout << "NO" endl;
| ^~~~~
| ;
|
s349479069 | p03693 | C++ | a,b,c=map(int,input().split())
if (a*100+b*10+c)%4==0:
print("YES")
else:
print("NO") | a.cc:1:1: error: 'a' does not name a type
1 | a,b,c=map(int,input().split())
| ^
|
s562662179 | p03693 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int r,g,b,a;
cin >> r >> g >> b;
a = 100*r+10**g+b;
if(a%4==0) cout >> "Yes" >>endl;
else cout >> "No" >> endl;
} | a.cc: In function 'int main()':
a.cc:7:16: error: invalid type argument of unary '*' (have 'int')
7 | a = 100*r+10**g+b;
| ^~
a.cc:8:19: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'const char [4]')
8 | if(a%4==0) cout >> "Yes" >>endl;
| ~~~~ ^~ ~~~~~
| | |
| | const char [4]
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41,
from a.cc:1:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:8:14: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~
In file included from /usr/include/c++/14/string:55,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)'
1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
| ^~~~~~~~
/usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>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 = const char (&)[4]]':
a.cc:8:22: required from here
8 | if(a%4==0) cout >> "Yes" >>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)
| ^~~~~~~~
/usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)'
509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143:
/usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)'
76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)'
106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)'
137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)'
177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
| ^~~~~~~~
/usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed:
a.cc:8:22: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
8 | if(a%4==0) cout >> "Yes" >>endl;
| ^~~~~
/usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basi |
s620850184 | p03693 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int r,g,b;
cin >> r >> g >> b;
if((10*g+r)%4==0){cout<< YES <<endl;}
cout<< NO <<endl;
} | a.cc: In function 'int main()':
a.cc:8:26: error: 'YES' was not declared in this scope
8 | if((10*g+r)%4==0){cout<< YES <<endl;}
| ^~~
a.cc:9:8: error: 'NO' was not declared in this scope
9 | cout<< NO <<endl;
| ^~
|
s851076126 | p03693 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int r,g,b;
cin >> r >> g >> b;
if((10*g+r)%4==0){cout<<YES<<endl;}
cout<<NO<<endl;
} | a.cc: In function 'int main()':
a.cc:8:25: error: 'YES' was not declared in this scope
8 | if((10*g+r)%4==0){cout<<YES<<endl;}
| ^~~
a.cc:9:7: error: 'NO' was not declared in this scope
9 | cout<<NO<<endl;
| ^~
|
s559834987 | p03693 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
int r, g, b;
cin << r << g << b;
if (100 * r + 10 * g + b % 4 == 0)
cout << "Yes" << "\n";
else
cout << "No" << "\n";
} | a.cc: In function 'int main()':
a.cc:8:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
8 | cin << r << g << b;
| ~~~ ^~ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:8:13: note: candidate: 'operator<<(int, int)' (built-in)
8 | cin << r << g << b;
| ~~~~^~~~
a.cc:8:13: 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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
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:8:9: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
8 | cin << r << g << b;
| ^~~
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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:9: required from here
8 | cin << r << g << b;
| ^
/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)
| ^~~~~~~~
|
s213076096 | p03693 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
int r, g, b;
cin << r << g << b;
if (100 * r + 10 * g + b % 4 == 0) {
cout << "Yes" << "\n";
else
cout << "No" << "\n";
} | a.cc: In function 'int main()':
a.cc:8:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
8 | cin << r << g << b;
| ~~~ ^~ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:8:13: note: candidate: 'operator<<(int, int)' (built-in)
8 | cin << r << g << b;
| ~~~~^~~~
a.cc:8:13: 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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
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:8:9: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
8 | cin << r << g << b;
| ^~~
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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
8 | cin << r << g << b;
| ^
/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:8:9: required from here
8 | cin << r << g << b;
| ^
/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)
| ^~~~~~~~
a.cc:11:9: error: expected '}' before 'else'
11 | else
| ^~~~
a.cc:9:44: note: to match this '{'
9 | if (100 * r + 10 * g + b % 4 == 0) {
| ^
|
s979033997 | p03693 | C | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int re = (100 * a) + (10 * b) + c;
if (re % 4 == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
} | main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s677347929 | p03693 | C | #include<bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int re = (100 * a) + (10 * b) + c;
if (re % 4 == 0) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
} | main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s416973073 | p03693 | C++ | #include<iostream>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
cout<<(b*10+c)%4==0?"YES":"NO";
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:19: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int')
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ~~~~~~~~~~~~~~~~^~~
| | |
| | int
| std::basic_ostream<char>
a.cc:6:19: note: candidate: 'operator==(int, int)' (built-in)
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ~~~~~~~~~~~~~~~~^~~
a.cc:6:19: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::allocator<_CharT>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/string_view:644: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>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/bits/basic_string.h:3755: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>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
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:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
a.cc:6:21: note: 'std::basic_ostream<char>' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
6 | cout<<(b*10+c)%4==0?"YES":"NO";
| ^
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:449:3: note: can |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.