submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s037307235 | p03854 | C++ | #include <algorithm>
#include <array>
#include <bitset>
#include <functional>
#include <iostream>
#include <memory>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
cin >> s;
bool ok = true;
for (int i = s.length() - 1; i >= 0; i--) {
switch (s[i]) {
case 'm': // "dream"
if (i >= 4 && strncmp(&s[i - 4], "dream", 5) == 0) {
i -= 4;
continue;
}
break;
case 'r': // "dreamer", "eraser"
if (i >= 6 && strncmp(&s[i - 6], "dreamer", 7) == 0) {
i -= 6;
continue;
}
if (i >= 5 && strncmp(&s[i - 5], "eraser", 6) == 0) {
i -= 5;
continue;
}
break;
case 'e': // "erase"
if (i >= 4 && strncmp(&s[i - 4], "erase", 5) == 0) {
i -= 4;
continue;
}
break;
default:
break;
}
ok = false;
break;
}
END:
cout << (ok ? "YES" : "NO") << endl;
}
| a.cc: In function 'int main()':
a.cc:20:39: error: 'strncmp' was not declared in this scope
20 | if (i >= 4 && strncmp(&s[i - 4], "dream", 5) == 0) {
| ^~~~~~~
a.cc:8:1: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
7 | #include <set>
+++ |+#include <cstring>
8 | #include <string>
a.cc:26:39: error: 'strncmp' was not declared in this scope
26 | if (i >= 6 && strncmp(&s[i - 6], "dreamer", 7) == 0) {
| ^~~~~~~
a.cc:26:39: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:30:39: error: 'strncmp' was not declared in this scope
30 | if (i >= 5 && strncmp(&s[i - 5], "eraser", 6) == 0) {
| ^~~~~~~
a.cc:30:39: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:36:39: error: 'strncmp' was not declared in this scope
36 | if (i >= 4 && strncmp(&s[i - 4], "erase", 5) == 0) {
| ^~~~~~~
a.cc:36:39: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s396953570 | p03854 | C++ | #include <stdio.h>
#include <string>
using namespace std;
int main() {
char S[100001];
scanf("%s", S);
int end = (int)strlen(S);
end--; // zero origin
bool match = false;
while (true) {
if (end == -1) {
match = true;
break;
}
char c = S[end];
if (c != 'r') {
char dream1 = S[end - 4];
char dream2 = S[end - 3];
char dream3 = S[end - 2];
char dream4 = S[end - 1];
char dream5 = S[end];
if (dream1 == 'd'
&& dream2 == 'r'
&& dream3 == 'e'
&& dream4 == 'a'
&& dream5 == 'm') {
end -= 5;
continue;
}
char erase1 = S[end - 4];
char erase2 = S[end - 3];
char erase3 = S[end - 2];
char erase4 = S[end - 1];
char erase5 = S[end];
if (erase1 == 'e'
&& erase2 == 'r'
&& erase3 == 'a'
&& erase4 == 's'
&& erase5 == 'e') {
end -= 5;
continue;
} else {
break;
}
} else {
c = S[end - 1];
if (c == 'e') {
char dreamer1 = S[end - 6];
char dreamer2 = S[end - 5];
char dreamer3 = S[end - 4];
char dreamer4 = S[end - 3];
char dreamer5 = S[end - 2];
char dreamer6 = S[end - 1];
char dreamer7 = S[end];
if (dreamer1 == 'd'
&& dreamer2 == 'r'
&& dreamer3 == 'e'
&& dreamer4 == 'a'
&& dreamer5 == 'm'
&& dreamer6 == 'e'
&& dreamer7 == 'r') {
end -= 7;
continue;
}
char eraser1 = S[end - 5];
char eraser2 = S[end - 4];
char eraser3 = S[end - 3];
char eraser4 = S[end - 2];
char eraser5 = S[end - 1];
char eraser6 = S[end];
if (eraser1 == 'e'
&& eraser2 == 'r'
&& eraser3 == 'a'
&& eraser4 == 's'
&& eraser5 == 'e'
&& eraser6 == 'r') {
end -= 6;
continue;
} else {
break;
}
} else {
break;
}
}
}
if (match) {
printf("YES\n");
} else {
printf("NO\n");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:20: error: 'strlen' was not declared in this scope
10 | int end = (int)strlen(S);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <string>
+++ |+#include <cstring>
3 |
|
s167484635 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string devide[4] = {"dream", "dreamer", "erase", "eraser"};
string S;
cin >> S;
reverse(S.begin(), S.end());
for(int i=0; i<4; ++i) reverese(devide[i].begin(), devide[i].end());
bool flag = true;
for(int i=0; i<S.size();){
bool flag2 = false;
for(int j=0; j<4; ++j){
string d = devide[j]
if(S.substr(i, d.size())==d){
flag2 = true;
i += d.size();
}
if (!flag2){
flag = false;
break;
}
}
}
if (flag){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:11:32: error: 'reverese' was not declared in this scope
11 | for(int i=0; i<4; ++i) reverese(devide[i].begin(), devide[i].end());
| ^~~~~~~~
a.cc:18:25: error: expected ',' or ';' before 'if'
18 | if(S.substr(i, d.size())==d){
| ^~
|
s661705717 | p03854 | C++ | #include <iostream>
#include <string>
#include <algorithm>
int main(){
string devide[4] = {"dream", "dreamer", "erase", "eraser"};
string S;
cin >> S;
reverse(S.begin(), S.end());
for(int i=0; i<4; ++i) reverese(devide[i].begin(), devide[i].end());
bool flag = true;
for(int i=0; i<S.size();){
bool flag2 = false;
for(int j=0; j<4; ++j){
string d = devide[j]
if(S.substr(i, d.size())==d){
flag2 = true;
i += d.size();
}
if (!flag2){
flag = false;
break;
}
}
}
if (flag){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
6 | string devide[4] = {"dream", "dreamer", "erase", "eraser"};
| ^~~~~~
a.cc:6:9: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:7:15: error: expected ';' before 'S'
7 | string S;
| ^~
| ;
a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
8 | cin >> S;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:8:16: error: 'S' was not declared in this scope
8 | cin >> S;
| ^
a.cc:9:9: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'?
9 | reverse(S.begin(), S.end());
| ^~~~~~~
| std::reverse
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
a.cc:10:41: error: 'devide' was not declared in this scope
10 | for(int i=0; i<4; ++i) reverese(devide[i].begin(), devide[i].end());
| ^~~~~~
a.cc:10:32: error: 'reverese' was not declared in this scope
10 | for(int i=0; i<4; ++i) reverese(devide[i].begin(), devide[i].end());
| ^~~~~~~~
a.cc:16:31: error: expected ';' before 'd'
16 | string d = devide[j]
| ^~
| ;
a.cc:28:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
28 | cout<<"YES"<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:28:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
28 | cout<<"YES"<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:30:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
30 | cout<<"NO"<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:30:29: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
30 | cout<<"NO"<<endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s878964839 | p03854 | C++ | import strutils
import sequtils
import algorithm
import unicode
var s = readLine(stdin)
var str = @["dream","dreamer","erase","erase"]
s = s.reversed
str = str.map(reversed)
while s != "":
var update = false
for now in str:
if s.len < now.len:
continue
elif s.substr(0,now.len - 1) == now:
s = s.substr(now.len,s.len - 1)
update = true
if update == false:
break
if s == "":
echo "YES"
else:
echo "NO" | a.cc:7:11: error: stray '@' in program
7 | var str = @["dream","dreamer","erase","erase"]
| ^
a.cc:1:1: error: 'import' does not name a type
1 | import strutils
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s708131781 | p03854 | Java | import java.util.Scanner;
public class Daydream {
public static void main(String[] args) {
String divide[] = { "dream", "dreamer", "erase", "eraser" };
Scanner sc = new Scanner(System.in);
String s = sc.next();
//すべての文字列を左右反転
StringBuffer sb = new StringBuffer(s);
s = sb.reverse().toString();
// System.out.println(s);
for (int i = 0; i < 4; i++) {
sb = new StringBuffer(divide[i]);
divide[i] = sb.reverse().toString();
// System.out.println(divide[i]);
}
//端から切っていく
boolean flg = true;
for (int i = 0; i < s.length();) {
boolean flg2 = false;//4この文字のうち、どれかでdevide出来るか判定
for (int j = 0; j < 4; j++) {
String d = divide[j];
System.out.println(s.substring(i, d.length()));
if (s.substring(i, d.length()).equals(d)) {//dでdivide出来るか
flg2 = true;
i += d.length();//divide出来たらiを進める
}
}
if (!flg2) {//divide出来なかったら
flg = false;
break;
}
}
if (flg) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
| Main.java:3: error: class Daydream is public, should be declared in a file named Daydream.java
public class Daydream {
^
1 error
|
s068889695 | p03854 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
string divide[4] = {"dream","dreamer","erase","eraser"}
string s;
cin >> s;
revers(s.begin(),s.end());
for(int i = 0; i <= 4; i++) revers(divide(i).begin(),divide(i).end());
bool can = true;
for(int i = 0; i < s.size();){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide[j];
if(d == s.substr(i,d.size()){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout<<"YES\n";
else cout <<"NO\n";
}
| a.cc: In function 'int main()':
a.cc:11:5: error: expected ',' or ';' before 'string'
11 | string s;
| ^~~~~~
a.cc:12:12: error: 's' was not declared in this scope
12 | cin >> s;
| ^
a.cc:14:5: error: 'revers' was not declared in this scope
14 | revers(s.begin(),s.end());
| ^~~~~~
a.cc:15:46: error: 'divide' cannot be used as a function
15 | for(int i = 0; i <= 4; i++) revers(divide(i).begin(),divide(i).end());
| ~~~~~~^~~
a.cc:15:64: error: 'divide' cannot be used as a function
15 | for(int i = 0; i <= 4; i++) revers(divide(i).begin(),divide(i).end());
| ~~~~~~^~~
a.cc:22:41: error: expected ')' before '{' token
22 | if(d == s.substr(i,d.size()){
| ~ ^
| )
a.cc:26:9: error: expected primary-expression before '}' token
26 | }
| ^
|
s545606533 | p03854 | C++ | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
divide = {"dream","dreamer","erase","eraser"}
string s;
cin >> s;
revers(s.begin(),s.end());
for(int i = 0; i <= 4; i++) revers(divide(i).begin(),divide(i).end());
bool can = true;
for(int i = 0; i < s.size();){
bool can2 = false;
for(int j = 0; j < 4; j++){
string d = divide[j];
if(d == str.substr(i,d.size()){
can2 = true;
i += d.size();
}
}
if(!can2){
can = false;
break;
}
}
if(can) cout<<"Yes\n";
else cout <<"No\n";
}
| a.cc: In function 'int main()':
a.cc:9:5: error: 'divide' was not declared in this scope
9 | divide = {"dream","dreamer","erase","eraser"}
| ^~~~~~
a.cc:12:12: error: 's' was not declared in this scope
12 | cin >> s;
| ^
a.cc:14:5: error: 'revers' was not declared in this scope
14 | revers(s.begin(),s.end());
| ^~~~~~
a.cc:22:21: error: 'str' was not declared in this scope; did you mean 'std'?
22 | if(d == str.substr(i,d.size()){
| ^~~
| std
a.cc:22:43: error: expected ')' before '{' token
22 | if(d == str.substr(i,d.size()){
| ~ ^
| )
a.cc:26:9: error: expected primary-expression before '}' token
26 | }
| ^
|
s633715701 | p03854 | C | #include <stdio.h>
#include <string.h>
int main() {
int i;
char s[100010];
scanf("%s", s);
i = strlen(s) - 1;
for (i >= 0)
{
if (s[i - 4] == 'd' && s[i - 3] == 'r' && s[i - 2] == 'e' && s[i - 1] == 'a' && s[i] == 'm') {
i -= 5;
}
if (s[i - 6] == 'd' && s[i - 5] == 'r' && s[i - 4] == 'e' && s[i -3] == 'a' && s[i- 2] == 'm' && s[i - 1] == 'e' && s[i] == 'r') {
i -= 7;
}
else if (s[i - 4] == 'e' && s[i - 3] == 'r' && s[i - 2] == 'a' && s[i - 1] == 's' && s[i] == 'e') {
i -= 5;
}
else if(s[i - 5] == 'e' && s[i - 4] == 'r' && s[i - 3] == 'a' && s[i - 2] == 's' && s[i - 1] == 'e' && s[i] == 'r'){
i -= 6;
}
else
{
printf("NO\n");
return 0;
}
}
printf("YES\n");
return 0;
}
| main.c: In function 'main':
main.c:8:20: error: expected ';' before ')' token
8 | for (i >= 0)
| ^
| ;
main.c:8:20: error: expected expression before ')' token
|
s449679666 | p03854 | C | #include <stdio.h>
#include <string.h>
int main() {
int len;
char s[100010];
scanf("%s", s);
i = strlen(s) - 1;
for (i >= 0)
{
if (s[i - 4] == 'd' && s[i - 3] == 'r' && s[i - 2] == 'e' && s[i - 1] == 'a' && s[i] == 'm') {
i -= 5;
}
if (s[i - 6] == 'd' && s[i - 5] == 'r' && s[i - 4] == 'e' && s[i -3] == 'a' && s[i- 2] == 'm' && s[i - 1] == 'e' && s[i] == 'r') {
i -= 7;
}
else if (s[i - 4] == 'e' && s[i - 3] == 'r' && s[i - 2] == 'a' && s[i - 1] == 's' && s[i] == 'e') {
i -= 5;
}
else if(s[i - 5] == 'e' && s[i - 4] == 'r' && s[i - 3] == 'a' && s[i - 2] == 's' && s[i - 1] == 'e' && s[i] == 'r'){
i -= 6;
}
else
{
printf("NO\n");
return 0;
}
}
printf("YES\n");
return 0;
} | main.c: In function 'main':
main.c:7:9: error: 'i' undeclared (first use in this function)
7 | i = strlen(s) - 1;
| ^
main.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:20: error: expected ';' before ')' token
8 | for (i >= 0)
| ^
| ;
main.c:8:20: error: expected expression before ')' token
|
s524661028 | p03854 | C++ | def main():
S = input()
s = len(S)
while s > 4:
e = s
for i in (5, 6, 7):
s = e - i
if S[s:e] in ('dream', 'dreamer', 'erase', 'eraser'):
break
else:
print('NO')
return
print('YES')
main()
| a.cc:9:27: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
9 | if S[s:e] in ('dream', 'dreamer', 'erase', 'eraser'):
| ^~~~~~~
a.cc:9:36: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
9 | if S[s:e] in ('dream', 'dreamer', 'erase', 'eraser'):
| ^~~~~~~~~
a.cc:9:47: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
9 | if S[s:e] in ('dream', 'dreamer', 'erase', 'eraser'):
| ^~~~~~~
a.cc:9:56: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
9 | if S[s:e] in ('dream', 'dreamer', 'erase', 'eraser'):
| ^~~~~~~~
a.cc:12:19: warning: multi-character character constant [-Wmultichar]
12 | print('NO')
| ^~~~
a.cc:14:11: warning: multi-character character constant [-Wmultichar]
14 | print('YES')
| ^~~~~
a.cc:1:1: error: 'def' does not name a type
1 | def main():
| ^~~
|
s278127734 | p03854 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
string s;
string divide[4] = { "dream", "dreamer", "erase", "eraser" };
int main() {
cin >> s;
reverse(s.begin(), s.end());
for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());
bool flag = true;
for (int i = 0; i < s.size();) {
bool flag2 = false;
for (int j = 0; j < 4; ++j) {
string str = divide[i];
if (s.substr(i, str.size()) == str) {
flag2 = true;
i += str.size());
}
}
if (!flag2) {
flag = false;
break;
}
}
if (flag) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:48: error: expected ';' before ')' token
20 | i += str.size());
| ^
| ;
|
s170820289 | p03854 | C++ | //#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)//初期値a,i<bの範囲でループ
#define REP(i,n) FOR(i,0,n)//初期値0,i<nの範囲でループ
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int main(){
string s;
cin>>s;
for(;;){
if(s.size()==0)break;
string s5,s6;
s5=s.substr(s.size()-5,5);
s6=s.substr(s.size()-6,6);
s7=s.substr(s.size()-7,7);
if(s6=="eraser"){
s=s.substr(0,s.size()-6);
}else if(s5=="erase"){
s=s.substr(0,s.size()-5);
}else if(s7=="dreamer"){
s=s.substr(0,s.size()-7);
}else if(s5=="dream"){
s=s.substr(0,s.size()-5);
}else{
cout<<"NO";
return 0;
}
}
cout<<"YES";
return 0;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 's7' was not declared in this scope; did you mean 's6'?
23 | s7=s.substr(s.size()-7,7);
| ^~
| s6
|
s033473480 | p03854 | C++ | //#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)//初期値a,i<bの範囲でループ
#define REP(i,n) FOR(i,0,n)//初期値0,i<nの範囲でループ
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int main(){
string s;
cin>>s;
for(;;){
if(s.size()==0)break;
string s5,s6;
s5=s.substr(s.size()-5,5);
s6=s.substr(s.size()-6,6);
s7=s.substr(s.size()-7,7;
if(s6=="eraser"){
s=s.substr(0,s.size()-6);
}else if(s5=="erase"){
s=s.substr(0,s.size()-5);
}else if(s7=="dreamer"){
s=s.substr(0,s.size()-7);
}else if(s5=="dream"){
s=s.substr(0,s.size()-5);
}else{
cout<<"NO";
return 0;
}
}
cout<<"YES";
return 0;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 's7' was not declared in this scope; did you mean 's6'?
23 | s7=s.substr(s.size()-7,7;
| ^~
| s6
a.cc:23:33: error: expected ')' before ';' token
23 | s7=s.substr(s.size()-7,7;
| ~ ^
| )
|
s194898033 | p03854 | C++ | //#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)//初期値a,i<bの範囲でループ
#define REP(i,n) FOR(i,0,n)//初期値0,i<nの範囲でループ
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int main(){
string s;
cin>>s;
for(;;){
if(s.size()==0)break;
string s5,s6;
s5=s.substr(s.size()-5,5);
s6=s.substr(s.size()-6,6);
s7=s.substr(s.size()-7,7;
if(s6=="eraser"){
s=substr(0,s.size()-6);
}else if(s5=="erase"){
s=substr(0,s.size()-5);
}else if(s7=="dreamer"){
s=substr(0,s.size()-7);
}else if(s5=="dream"){
s=s.substr(0,s.size()-5);
}else{
cout<<"NO";
return 0;
}
}
cout<<"YES";
return 0;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 's7' was not declared in this scope; did you mean 's6'?
23 | s7=s.substr(s.size()-7,7;
| ^~
| s6
a.cc:23:33: error: expected ')' before ';' token
23 | s7=s.substr(s.size()-7,7;
| ~ ^
| )
a.cc:26:15: error: 'substr' was not declared in this scope
26 | s=substr(0,s.size()-6);
| ^~~~~~
a.cc:28:15: error: 'substr' was not declared in this scope
28 | s=substr(0,s.size()-5);
| ^~~~~~
a.cc:30:15: error: 'substr' was not declared in this scope
30 | s=substr(0,s.size()-7);
| ^~~~~~
|
s303910489 | p03854 | C++ | #include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <regex>
#include <set>
#include <string>
#include <vector>
#include <cstring>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;
using std::min;
using std::max;
using std::sort;
using std::abs;
int main() {
string s;
cin >> s;
bool possible = true;
bool er_flag = false;
size_t i = 0;
while (i < s.length()) {
if(s.substr(i, 5) == "dream"){
i += 5;
er_flag = true;
}
else if(s.substr(i, 5) == "erase"){
i += 5;
er_flag = true;
}
else if(s.substr(i, 2) == "er"){
i += 2;
er_flag = false;
}
else{
possible = false;
break;
}
}
cout << (ans ? "YES" : "NO") << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:55:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
55 | cout << (ans ? "YES" : "NO") << endl;
| ^~~
| abs
|
s780329900 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
reverse(s.begin(), s.end());
for (int i = 0; i < s.size(); i++) {
if (s.substr(0, 7) == "remaerd") s = s.substr(7, s.size() - 7);
else if (s.substr(0, 6) == "resare") s = s.substr(6, s.size() - 6);
else if (s.substr(0, 5) == "maerd") s = s.substr(5, s.size() - 5);
else if (s.substr(0, 5) == "esare") s = s.substr(5, s.size() - 5);
else {
cout << "NO" << endl;
return 0;
}
if (s.size() == 0) {
cout << "YES" << endl;
return 0;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'reverse' was not declared in this scope
11 | reverse(s.begin(), s.end());
| ^~~~~~~
|
s460707847 | p03854 | C++ | #include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;
int main(void)
{
string S;
cin >> S;
string str(S);
reverse(str.begin(), str.end());
string operation[4] = {"dreamer", "dream", "eraser", "erase"};
for(int i=0; i<4; i++)
reverse(operation[i].begin(), operation[i].end());
auto it = str.begin();
while(it != str.end())
{
bool ok = false;
for(int i=0; i<4; i++)
{
if(str.substr(it-str.begin(), operation[i].size()) == operation[i])
{
it += operation[i].size();
ok = true;
break;
}
}
if(ok != true)
break;
}
string ret;
if(it == str.end())
ret = "YES";
else
ret = "NO";
cout << ret << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:9: error: 'reverse' was not declared in this scope
13 | reverse(str.begin(), str.end());
| ^~~~~~~
|
s502528122 | p03854 | C++ | #include <bits/stdc++.h>
char str[110000];
std::regex pattern ("(erase|eraser|dream|dreamer)*");
int main () {
gets (str);
if (std::regex_match (str, pattern))
puts ("YES");
else
puts ("NO");
}
| a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets (str);
| ^~~~
| getw
|
s944551412 | p03854 | C++ | #include <bits/stdc++.h>
char str[110000];
std::regex pattern ("(erase|eraser|dream|dreamer)*");
int main () {
gets (str);
if (std::regex_match (str, pattern))
puts ("YES");
else
puts ("NO");
}
| a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets (str);
| ^~~~
| getw
|
s274742801 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
String inverse = "";
for(int i = S.length() - 1; i >= 0; i--) {
inverse += String.valueOf(S.charAt(i));
}
String s1 = "maerd";
String s2 = "remaerd";
String s3 = "esare";
String s4 = "resare";
String ans = "YES";
int pos = 0;
while(pos < S.length()) {
String str5;
String str6;
String str7;
char c = inverse.charAt(pos);
if(pos + 5 <= S.length()) {
str5 = inverse.substring(pos, pos + 5);
}
if(pos + 6 <= S.length()) {
str6 = inverse.substring(pos, pos + 6);
}
if(pos + 7 <= S.length()) {
str7 = inverse.substring(pos, pos + 7);
}
if((pos + 5 <= S.length()) && (s1.equals(str5))) {
pos += 5;
} else if((pos + 7 <= S.length()) && (s2.equals(str7))) {
pos += 7;
} else if((pos + 5 <= S.length()) && (s3.equals(str5))) {
pos += 5;
} else if((pos + 6 <= S.length()) && (s4.equals(str6))) {
pos += 6;
} else {
ans = "NO";
break;
}
}
System.out.println(ans);
}
}
| Main.java:31: error: variable str5 might not have been initialized
if((pos + 5 <= S.length()) && (s1.equals(str5))) {
^
Main.java:33: error: variable str7 might not have been initialized
} else if((pos + 7 <= S.length()) && (s2.equals(str7))) {
^
Main.java:35: error: variable str5 might not have been initialized
} else if((pos + 5 <= S.length()) && (s3.equals(str5))) {
^
Main.java:37: error: variable str6 might not have been initialized
} else if((pos + 6 <= S.length()) && (s4.equals(str6))) {
^
4 errors
|
s998970310 | p03854 | C | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
String inverse = "";
int l=S.length();
for(int i = l - 1; i >= 0; i--) {
inverse += String.valueOf(S.charAt(i));
}
String s1 = "maerd";
String s2 = "remaerd";
String s3 = "esare";
String s4 = "resare";
String ans = "YES";
for(int i = 0; i < l;) {
if((i + 5 <= l) && (s1.equals(inverse.substring(i, i + 5)))) {
i += 5;
} else if((i + 7 <= l) && (s2.equals(inverse.substring(i, i + 7)))) {
i += 7;
} else if((i + 5 <= l) && (s3.equals(inverse.substring(i, i + 5)))) {
i += 5;
} else if((i + 6 <= l) && (s4.equals(inverse.substring(i, i + 6)))) {
i += 6;
} else {
ans = "NO";
break;
}
}
System.out.println(ans);
}
} | main.c:1:1: error: unknown type name 'import'
1 | import java.util.*;
| ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
1 | import java.util.*;
| ^
main.c:3:1: error: unknown type name 'public'
3 | public class Main {
| ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
3 | public class Main {
| ^~~~
|
s903376599 | p03854 | Java | public class Main {
public static void main(String[] args) throws IOException {
BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
String str = input.readLine( );
while(str.length() != 0){
if(str.matches("^(dreamer)+.*") && !str.startsWith("dreamerase")){
while(str.matches("^(dreamer)+.*") && !str.startsWith("dreamerase")){
str = str.substring(7);
}
}else if(str.matches("^(eraser)+.*")){
while(str.matches("^(eraser)+.*")){
str = str.substring(6);
}
}else if(str.matches("^(dream)+.*") || str.matches("^(erase)+.*")){
str = str.substring(5);
}else{
System.out.println("NO");
System.exit(0);
}
}
System.out.println("YES");
}
} | Main.java:3: error: cannot find symbol
public static void main(String[] args) throws IOException {
^
symbol: class IOException
location: class Main
Main.java:4: error: cannot find symbol
BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:4: error: cannot find symbol
BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
^
symbol: class BufferedReader
location: class Main
Main.java:4: error: cannot find symbol
BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
^
symbol: class InputStreamReader
location: class Main
4 errors
|
s805444609 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int len = S.length();
String ans = "NO";
if(len >= 5) {
// dp[i]はインデックスi~末尾までの部分文字列に対する判定結果を返す(出来るなら1、出来ないなら-1)
int[] dp = new int[len];
dp[len - 1] = -1;
dp[len - 2] = -1;
dp[len - 3] = -1;
dp[len - 4] = -1;
dp[len - 5] = -1;
String str = S.substring(len - 5);
if(str.equals("dream") || str.equals("erase")) dp[len - 5] = 1;
for(int i = len - 6; i >= 0; i--) {
dp[i] = -1;
String str5 = S.substring(i, i + 5);
String str6 = S.substring(i, i + 6);
String str7;
if(i + 7 <= len) str7 = S.substring(i, i + 7);
if((str5.equals("dream") || str5.equals("erase")) && dp[i + 5] == 1) dp[i] = 1;
if(str6.equals("eraser") && dp[i + 6] == 1) dp[i] = 1;
if((i + 7 <= len) && str7.equals("dreamer") && dp[i + 7] == 1) dp[i] = 1;
}
if(dp[0] == 1) ans = "YES";
}
System.out.println(ans);
}
} | Main.java:27: error: variable str7 might not have been initialized
if((i + 7 <= len) && str7.equals("dreamer") && dp[i + 7] == 1) dp[i] = 1;
^
1 error
|
s969559777 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int len = S.length();
String ans = "NO";
if(len >= 5) {
// dp[i]はインデックスi~末尾までの部分文字列に対する判定結果を返す(出来るなら1、出来ないなら-1)
int[] dp = new int[len];
dp[len - 1] = -1;
dp[len - 2] = -1;
dp[len - 3] = -1;
dp[len - 4] = -1;
dp[len - 5] = -1;
String str = S.substring(len - 5);
if(str.equals("dream") || str.equals("erase")) dp[len - 5] = 1;
for(int i = len - 6; i >= 0; i--) {
dp[i] = -1;
String str5 = S.substring(i, i + 5);
String str6 = S.substring(i, i + 6);
if((i + 7) <= len) String str7 = S.substring(i, i + 7);
if((str5.equals("dream") || str5.equals("erase")) && dp[i + 5] == 1) dp[i] = 1;
if(str6.equals("eraser") && dp[i + 6] == 1) dp[i] = 1;
if(((i + 7) <= len) && str7.equals("dreamer") && dp[i + 7] == 1) dp[i] = 1;
}
if(dp[0] == 1) ans = "YES";
}
System.out.println(ans);
}
} | Main.java:23: error: variable declaration not allowed here
if((i + 7) <= len) String str7 = S.substring(i, i + 7);
^
1 error
|
s285387529 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int len = S.length();
String ans = "NO";
if(len >= 5) {
// dp[i]はインデックスi~末尾までの部分文字列に対する判定結果を返す(出来るなら1、出来ないなら-1)
int[] dp = new int[len];
dp[len - 1] = -1;
dp[len - 2] = -1;
dp[len - 3] = -1;
dp[len - 4] = -1;
dp[len - 5] = -1;
String str = S.substring(len - 5);
if(str.equals("dream") || str.equals("erase")) dp[len - 5] = 1;
for(int i = len - 6; i >= 0; i--) {
dp[i] = -1;
String str5 = S.substring(i, i + 5);
String str6 = S.substring(i, i + 6);
if(i + 7 <= len) String str7 = S.substring(i, i + 7);
if((str5.equals("dream") || str5.equals("erase")) && dp[i + 5] == 1) dp[i] = 1;
if(str6.equals("eraser") && dp[i + 6] == 1) dp[i] = 1;
if((i + 7 <= len) && str7.equals("dreamer") && dp[i + 7] == 1) dp[i] = 1;
}
if(dp[0] == 1) ans = "YES";
}
System.out.println(ans);
}
} | Main.java:23: error: variable declaration not allowed here
if(i + 7 <= len) String str7 = S.substring(i, i + 7);
^
1 error
|
s365071703 | p03854 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int len = S.length();
String ans = "NO";
if(len >= 5) {
// dp[i]はインデックスi~末尾までの部分文字列に対する判定結果を返す(出来るなら1、出来ないなら-1)
int[] dp = new int[len];
dp[len - 1] = -1;
dp[len - 2] = -1;
dp[len - 3] = -1;
dp[len - 4] = -1;
dp[len - 5] = -1;
String str = S.substring(i - 5);
if(str.equals("dream") || str.equals("erase")) dp[len - 5] = 1;
for(int i = len - 6; i >= 0; i--) {
dp[i] = -1;
String str5 = S.substring(i, i + 5);
String str6 = S.substring(i, i + 6);
String str7 = S.substring(i, i + 7);
if((str5.equals("dream") || str5.equals("erase")) && dp[i + 5] == 1) dp[i] = 1;
if(str6.equals("eraser") && dp[i + 6] == 1) dp[i] = 1;
if(str7.equals("dreamer") && dp[i + 7] == 1) dp[i] = 1;
}
if(dp[0] == 1) ans = "YES";
}
System.out.println(ans);
}
} | Main.java:17: error: cannot find symbol
String str = S.substring(i - 5);
^
symbol: variable i
location: class Main
1 error
|
s865233179 | p03854 | Java | import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
String s = sc.next();
int e = s.length();
while(true) {
if (e==0) {
break;
} else if (e<5) {
System.out.println("NO");
return;
}
if (s.substring(e-5, e).equals("erase")) {
e -= 5;
} else if (s.substring(e-5, e).equals("dream")) {
e -= 5;
} else if (s.substring(e-6, e).equals("eraser")) {
e -= 6;
} else if (s.substring(e-7, e).equals("dreamer")) {
e -= 7;
} else {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
} | Main.java:2: error: illegal character: '\u00a0'
?
^
Main.java:15: error: illegal character: '\u00a0'
?
^
Main.java:29: error: illegal character: '\u00a0'
?
^
3 errors
|
s157888315 | p03854 | Java | import java.util.Scanner;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
String s = sc.next();
int e = s.length();
while(true) {
if (e==0) {
break;
} else if (e<5) {
System.out.println("NO");
return;
}
if (s.substring(e-5, e).equals("erase")) {
e -= 5;
} else if (s.substring(e-5, e).equals("dream")) {
e -= 5;
} else if (s.substring(e-6, e).equals("eraser")) {
e -= 6;
} else if (s.substring(e-7, e).equals("dreamer")) {
e -= 7;
} else {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
} | Main.java:2: error: illegal character: '\u00a0'
?
^
Main.java:15: error: illegal character: '\u00a0'
?
^
Main.java:29: error: illegal character: '\u00a0'
?
^
3 errors
|
s755965412 | p03854 | C++ | s=gets.chop
k=s.size
while k>0
if s[k-5, 5]=='dream' or s[k-5, 5]=='erase'
k-=5
elsif s[k-6, 6]=='eraser'
k-=6
elsif s[k-7, 7]=='dreamer'
k-=7
else
break
end
end
puts (k>0 ? "NO" : "YES")
| a.cc:4:19: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
4 | if s[k-5, 5]=='dream' or s[k-5, 5]=='erase'
| ^~~~~~~
a.cc:4:41: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
4 | if s[k-5, 5]=='dream' or s[k-5, 5]=='erase'
| ^~~~~~~
a.cc:6:22: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
6 | elsif s[k-6, 6]=='eraser'
| ^~~~~~~~
a.cc:8:22: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
8 | elsif s[k-7, 7]=='dreamer'
| ^~~~~~~~~
a.cc:1:1: error: 's' does not name a type
1 | s=gets.chop
| ^
|
s830832704 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
int flag=1;
cin >> str;
string dream = "maerd";
string dreamer = "remaerd";
string erase = "esare";
string eraser = "resare";
reverse(begin(str),end(str));
while(flag!=0)
{
flag = 0;
if(dream==str.substr(0,5))
{
str.replace(0,5,"");
flag = 1;
}
if(dreamer==str.substr(0,7))
{
str.replace(0,7,"");
flag = 1;
}
if(erase==str.substr(0,5))
{
str.replace(0,5,"");
flag = 1;
}
if(eraser==str.substr(0,6))
{
str.replace(0,6,"");
flag = 1;
}
}
if(str=="")
{
cout << "YES" <<endl;
}else{
cout << "NO" <<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'reverse' was not declared in this scope
15 | reverse(begin(str),end(str));
| ^~~~~~~
|
s511312718 | p03854 | C | #include <stdio.h>
#include <string.h>
char *tbl[] = {"dreamer", "eraser", "dream", "erase"};
int len[] {6, 6, 5, 5};
char str[100001];
int main() {
scanf("%s", str);
while(*str != '\0') {
for(pos = 0; pos < 4; pos++) {
if(strncmp(tbl[pos], str, len[pos])) == 0) {
break;
}
}
if(pos == 4) {
printf("NO\n");
return 0;
}
str += len[pos];
}
printf("YES\n");
return 0;
} | main.c:5:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
5 | int len[] {6, 6, 5, 5};
| ^
main.c: In function 'main':
main.c:13:21: error: 'pos' undeclared (first use in this function)
13 | for(pos = 0; pos < 4; pos++) {
| ^~~
main.c:13:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:51: error: 'len' undeclared (first use in this function)
14 | if(strncmp(tbl[pos], str, len[pos])) == 0) {
| ^~~
main.c:14:62: error: expected expression before '==' token
14 | if(strncmp(tbl[pos], str, len[pos])) == 0) {
| ^~
main.c:14:66: error: expected statement before ')' token
14 | if(strncmp(tbl[pos], str, len[pos])) == 0) {
| ^
|
s262291184 | p03854 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
bool isok=true;
const string st[4]={"dream","dreamer","erase","eraser"};
for(int i=s.size()-1;i>=0;i++){
if(s[i]=='r'){
if(i-2>=0){
if(s[i-2]=='m' && i-6>=0){
for(int j=0;j<7;j++){
if(s[i-j]!=st[1][6-j]){
isok=false;
}
}
i-=7;
}
else if(s[i-2]=='s' && i=5>=0){
for(int j=0;j<6;j++){
if(s[i-j]!=st[3][5-j]){
isok=false;
}
}
i-=6;
}
}
else{
isok=false;
}
}
else if(s[i]=='m'){
for(int j=0;j<5;j++){
if(i-j<0 || s[i-j]!=st[0][4-j]){
isok=false;
}
}
i-=5;
}
else if(s[i]=='e'){
for(int j=0;j<5;j++){
if(i-j<0 || s[i-j]!=st[2][4-j]){
isok=false;
}
}
}
else{
isok=false;
}
}
if(isok) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} | a.cc: In function 'int main()':
a.cc:21:37: error: lvalue required as left operand of assignment
21 | else if(s[i-2]=='s' && i=5>=0){
|
s642634915 | p03854 | C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main() {
char buf1[20000];
strcpy(buf1,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
char *buf=(char*)malloc(sizeof(char) * 20000);
scanf("%[^\n]", buf);
char* cur = buf;
int length = strlen(buf);
char l1[] = "dream";
char l2[] = "dreamer";
char l3[] = "erase";
char l4[] = "eraser";
int a1 = 5;
int a2 = 7;
int a3 = 5;
int a4 = 6;
while (length > 0) {
if (strstr(cur, l4) == cur) {
length -= a4;
if(length <= 0) {
break;
}
cur = cur + a4;
} else if (strstr(cur, l3) == cur) {
length -= a3;
if(length <= 0) {
break;
}
cur = cur + a3;
} else if (strstr(cur, "dreamerase") == cur) {
length -= a1;
if(length <= 0) {
break;
}
cur = cur + a1;
} else if (strstr(cur, l2) == cur) {
length -= a2;
if(length <= 0) {
break;
}
cur = cur + a2;
} else if (strstr(cur, l1) == cur) {
length -= a1;
if(length <= 0) {
break;
}
cur = cur + a1;
} else {
break;
}
}
if (length == 0) {
printf("YES\n");
} else {
printf("NO\n");
}
return 0;
} | main.c: In function 'main':
main.c:8:1: error: expected ';' before 'char'
8 | strcpy(buf1,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaa |
s335166783 | p03854 | C++ |
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
string pattern[] = {"remaerd", "resare", "maerd", "esare"};
string S;
cin >> S;
//Sを反転
reverse(S.begin(), S.end());
cout << S.substr(S.length(),-5);
int temp = 0;
bool possible = true;
while(temp < S.length()){
bool clear = false;
for(auto p:pattern){
string t = S.substr(temp,p.length());
if(t == p){
temp += p.length();
clear = true;
break;
}
}
if(!clear){ possible = false; break;}
}
if(possible) cout << "YES";
else cout << "NO";
return 0;
} | a.cc: In function 'int main(int, const char**)':
a.cc:10:5: error: 'reverse' was not declared in this scope
10 | reverse(S.begin(), S.end());
| ^~~~~~~
|
s107755077 | p03854 | Java | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String S=sc.next();
if(S.length()<5)System.out.println("NO");
StringBuilder s=new StringBuilder(S);
ArrayList<String>de=new ArrayList<>();
de.add("dream");
de.add("dreamer");
de.add("erase");
de.add("eraser");
while(true){
if(de.contains(s.substring(0,s.length()))){System.out.println("YES");break;}
if(s.length()<5 || s.length()==6 || s.length()==8 || s.length()==9){System.out.println("NO");break;}
if(s.substring(0,6).equals("dreamd")||s.substring(0,6).equals("dreame"))s.delete(0,5);
else if(s.length()>=6&&(s.substring(0,6).equals("erasee")||s.substring(0,6).equals("erased")))s.delete(0,5);
else if(s.length()>=7&&(s.substring(0,7).equals("erasere")||s.substring(0,7).equals("eraserd")))s.delete(0,6);
else if(s.length()>=8&&(s.substring(0,8).equals("dreamerd")||s.substring(0,8).equals("dreamere")))s.delete(0,7);
else {System.out.println("NO");break;}
}
} | Main.java:29: error: reached end of file while parsing
}
^
1 error
|
s673970436 | p03854 | C++ | #include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
int main() {
int flag = 1;
int sum = 0;
string s;
cin >> s;
reverse(s.begin(), s.end());
size_t dreamer, eraser, dream, erase;
while (1)
{
dream = s.find("maerd");
if (dream == 0)
{
s.replace(dream, 5, "0");
s.erase(s.begin() + dream);
continue;
}
dreamer = s.find("remaerd");
if (dreamer == 0)
{
s.replace(dreamer, 7, "0");
s.erase(s.begin() + dreamer);
continue;
}
erase = s.find("esare");
if (erase == 0)
{
s.replace(erase, 5, "0");
s.erase(s.begin() + erase);
continue;
}
eraser = s.find("resare");
if (eraser == 0)
{
s.replace(eraser, 6, "0");
s.erase(s.begin() + eraser);
continue;
}
//dreamer = s.find("remaerd");
//eraser = s.find("resare");
//dream = s.find("maerd");
//erase = s.find("esare");
if (dreamer == -1 && eraser == -1 && dream == -1 && erase == -1)
{
if (s[0] == NULL)
{
cout << "Yes" << endl;
exit(0);
}
else
{
cout << "No" << endl;
exit(0);
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:5: error: 'reverse' was not declared in this scope
14 | reverse(s.begin(), s.end());
| ^~~~~~~
a.cc:62:25: warning: NULL used in arithmetic [-Wpointer-arith]
62 | if (s[0] == NULL)
| ^~~~
|
s771668094 | p03854 | C++ | #include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
int main() {
int flag = 1;
int sum = 0;
string s;
cin >> s;
reverse(s.begin(), s.end());
while (1)
{
size_t dreamer, eraser, dream, erase;
dream = s.find("maerd");
if (dream == 0)
{
s.replace(dream, 5, "0");
s.erase(s.begin() + dream);
continue;
}
dreamer = s.find("remaerd");
if (dreamer == 0)
{
s.replace(dreamer, 7, "0");
s.erase(s.begin() + dreamer);
continue;
}
erase = s.find("esare");
if (erase == 0)
{
s.replace(erase, 5, "0");
s.erase(s.begin() + erase);
continue;
}
eraser = s.find("resare");
if (eraser == 0)
{
s.replace(eraser, 6, "0");
s.erase(s.begin() + eraser);
continue;
}
//dreamer = s.find("remaerd");
//eraser = s.find("resare");
//dream = s.find("maerd");
//erase = s.find("esare");
if (dreamer == -1 && eraser == -1 && dream == -1 && erase == -1)
{
for (int i = 0; i < s.length(); i++)
{
sum += s[i] - 48;
}
if (sum == 0)
{
cout << "Yes" << endl;
exit(0);
}
else
{
cout << "No" << endl;
exit(0);
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:5: error: 'reverse' was not declared in this scope
14 | reverse(s.begin(), s.end());
| ^~~~~~~
|
s633358993 | p03854 | C++ | #include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
int main() {
int flag = 1;
int sum = 0;
string s;
cin >> s;
reverse(s.begin(), s.end());
while (1)
{
size_t dreamer, eraser, dream, erase;
dream = s.find("maerd");
if (dream != -1)
{
s.replace(dream, 5, "0");
}
dreamer = s.find("remaerd");
if (dreamer != -1)
{
s.replace(dreamer, 7, "0");
}
erase = s.find("esare");
if (erase != -1)
{
s.replace(erase, 5, "0");
}
eraser = s.find("resare");
if (eraser != -1)
{
s.replace(eraser, 6, "0");
}
dreamer = s.find("remaerd");
eraser = s.find("resare");
dream = s.find("maerd");
erase = s.find("esare");
if (dreamer == -1 && eraser == -1 && dream == -1 && erase == -1)
{
for (int i = 0; i < s.length(); i++)
{
sum += s[i] - 48;
}
if (sum == 0)
{
cout << "Yes" << endl;
exit(0);
}
else
{
cout << "No" << endl;
exit(0);
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:5: error: 'reverse' was not declared in this scope
14 | reverse(s.begin(), s.end());
| ^~~~~~~
|
s183849696 | p03854 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
/*String s = sc.next().substring(0,100000);*/
while(true){
if(s.equals("")){
System.out.println("YES");
return;
}else if( (s.length()>=11)&&(s.substring(0,11).equals("dreameraser"))){
s = s.substring(11);
}else if( (s.length()>=10)&&(s.substring(0,10).equals("dreamerase"))){
s = s.substring(10);
}else if( (s.length()>=7)&&(s.substring(0,7).equals("dreamer"))){
s = s.substring(7);
}else if( (s.length()>=6)&&(s.substring(0,6).equals("eraser"))){
s = s.substring(6);
}else if( (s.length()>=5)&&(s.substring(0,5).equals("dream"))){
s = s.substring(5);
}else if( (s.length()>=5)&&(s.substring(0,5).equals("erase"))){
s = s.substring(5);
}else{
System.out.println("NO");
return;
}
}
}
} | Main.java:8: error: cannot find symbol
if(s.equals("")){
^
symbol: variable s
location: class Main
Main.java:11: error: cannot find symbol
}else if( (s.length()>=11)&&(s.substring(0,11).equals("dreameraser"))){
^
symbol: variable s
location: class Main
Main.java:11: error: cannot find symbol
}else if( (s.length()>=11)&&(s.substring(0,11).equals("dreameraser"))){
^
symbol: variable s
location: class Main
Main.java:12: error: cannot find symbol
s = s.substring(11);
^
symbol: variable s
location: class Main
Main.java:12: error: cannot find symbol
s = s.substring(11);
^
symbol: variable s
location: class Main
Main.java:13: error: cannot find symbol
}else if( (s.length()>=10)&&(s.substring(0,10).equals("dreamerase"))){
^
symbol: variable s
location: class Main
Main.java:13: error: cannot find symbol
}else if( (s.length()>=10)&&(s.substring(0,10).equals("dreamerase"))){
^
symbol: variable s
location: class Main
Main.java:14: error: cannot find symbol
s = s.substring(10);
^
symbol: variable s
location: class Main
Main.java:14: error: cannot find symbol
s = s.substring(10);
^
symbol: variable s
location: class Main
Main.java:15: error: cannot find symbol
}else if( (s.length()>=7)&&(s.substring(0,7).equals("dreamer"))){
^
symbol: variable s
location: class Main
Main.java:15: error: cannot find symbol
}else if( (s.length()>=7)&&(s.substring(0,7).equals("dreamer"))){
^
symbol: variable s
location: class Main
Main.java:16: error: cannot find symbol
s = s.substring(7);
^
symbol: variable s
location: class Main
Main.java:16: error: cannot find symbol
s = s.substring(7);
^
symbol: variable s
location: class Main
Main.java:17: error: cannot find symbol
}else if( (s.length()>=6)&&(s.substring(0,6).equals("eraser"))){
^
symbol: variable s
location: class Main
Main.java:17: error: cannot find symbol
}else if( (s.length()>=6)&&(s.substring(0,6).equals("eraser"))){
^
symbol: variable s
location: class Main
Main.java:18: error: cannot find symbol
s = s.substring(6);
^
symbol: variable s
location: class Main
Main.java:18: error: cannot find symbol
s = s.substring(6);
^
symbol: variable s
location: class Main
Main.java:19: error: cannot find symbol
}else if( (s.length()>=5)&&(s.substring(0,5).equals("dream"))){
^
symbol: variable s
location: class Main
Main.java:19: error: cannot find symbol
}else if( (s.length()>=5)&&(s.substring(0,5).equals("dream"))){
^
symbol: variable s
location: class Main
Main.java:20: error: cannot find symbol
s = s.substring(5);
^
symbol: variable s
location: class Main
Main.java:20: error: cannot find symbol
s = s.substring(5);
^
symbol: variable s
location: class Main
Main.java:21: error: cannot find symbol
}else if( (s.length()>=5)&&(s.substring(0,5).equals("erase"))){
^
symbol: variable s
location: class Main
Main.java:21: error: cannot find symbol
}else if( (s.length()>=5)&&(s.substring(0,5).equals("erase"))){
^
symbol: variable s
location: class Main
Main.java:22: error: cannot find symbol
s = s.substring(5);
^
symbol: variable s
location: class Main
Main.java:22: error: cannot find symbol
s = s.substring(5);
^
symbol: variable s
location: class Main
25 errors
|
s880884953 | p03854 | C++ |
#include <iostream>
#include <vector>
#include <array>
#include <cmath>
using namespace std;
#define ll long long
int main()
{
// Value
string S;
string result = "YES";
// Input
cin>>S;
// Cal
ll size = S.size();
ll cnt=0;
for(;cnt<size-4;){
//
string five = S.substr(cnt, 5);
string six;
string seven;
string tt;
if(cnt<size-5) six = S.substr(cnt, 6);
if(cnt<size-6) seven = S.substr(cnt, 7);
if(cnt<size-10) tt = S.substr(cnt, 11);
if(cnt<size-10 && tt = "dreameraser"){
cnt+=11;
}else if(cnt<size-6 && seven == "dreamer"){
cnt+=7;
}else if(cnt<size-5 && six == "eraser"){
cnt+=6;
}else if(five == "dream" || five == "erase"){
cnt+=5;
}else{
result = "NO";
break;
}
}
if(cnt!=size) result="NO";
// Output
cout << result << endl;
// Fin
return 0;
}
| a.cc: In function 'int main()':
a.cc:32:24: error: no match for 'operator&&' (operand types are 'bool' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
32 | if(cnt<size-10 && tt = "dreameraser"){
| ~~~~~~~~~~~ ^~ ~~
| | |
| bool std::string {aka std::__cxx11::basic_string<char>}
a.cc:32:24: note: candidate: 'operator&&(bool, bool)' (built-in)
32 | if(cnt<size-10 && tt = "dreameraser"){
| ~~~~~~~~~~~~^~~~~
a.cc:32:24: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
|
s047261366 | p03854 | C++ |
#include <iostream>
#include <vector>
#include <array>
#include <cmath>
using namespace std;
#define ll long long
int main_()
{
// Value
string S;
string result = "YES";
// Input
cin>>S;
// Cal
ll size = S.size();
ll cnt=0;
for(;cnt<size-4;){
//
string five = S.substr(cnt, 5);
string six;
if(cnt<size-5) six = S.substr(cnt, 6);
if(cnt<size-5 &&( six == "dreamer" || six == "eraser")){
cnt+=6;
}else if(five == "dream" || five == "erase"){
cnt+=5;
}else{
result = "NO";
break;
}
}
if(cnt!=size) result="NO";
// Output
cout << result << endl;
// Fin
return 0;
}
| /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s561058315 | p03854 | C++ | #include <iostream>
#include <vector>
#include <array>
#include <cmath>
using namespace std;
#define ll long long
int main_()
{
// Value
string S;
string result = "YES";
// Input
cin>>S;
// Cal
ll size = S.size();
ll cnt=0;
for(;cnt<size-4;){
//
string five = S.substr(cnt, 5);
string six;
if(cnt<size-5) six = S.substr(cnt, 6);
if(cnt<size-5 || six == "dreamer" || six == "eraser"){
cnt+=6;
}else if(five == "dream" || five == "erase"){
cnt+=5;
}else{
result = "NO";
break;
}
}
if(cnt!=size) result="NO";
// Output
cout << result << endl;
// Fin
return 0;
}
| /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s820741107 | p03854 | C++ |
#include <iostream>
#include <vector>
#include <array>
#include <cmath>
using namespace std;
#define ll long long
int main()
{
// Value
string S;
string result = "YES";
// Input
cin>>S;
// Cal
ll size = S.size();
for(int cnt=0;cnt<size-5;){
//
string five = S.substr(cnt, 5);
string six;
if(cnt<size-6) six = S.substr(cnt, 6);
if(six == "dreamer" || six == "eraser"){
cnt+=6;
}else if(cnt<size-6 || five == "dream" || five == "erase"){
cnt+=5;
}else{
result = "NO";
break;
}
}
if(cnt!=size) result="NO";
// Output
cout << result << endl;
// Fin
return 0;
}
| a.cc: In function 'int main()':
a.cc:36:8: error: 'cnt' was not declared in this scope; did you mean 'int'?
36 | if(cnt!=size) result="NO";
| ^~~
| int
|
s922920710 | p03854 | C++ | #include <iostream>
#include <vector>
#include <array>
#include <cmath>
using namespace std;
#define ll long long
int main()
{
// Value
string S;
string result = "YES";
// Input
cin>>S;
// Cal
ll size = S.size();
for(int cnt=0;cnt<size-5;){
//
string five = S.substr(cnt, 5);
if(cnt!=size-7) string six = S.substr(cnt, 6);
if(six == "dreamer" || six == "eraser"){
cnt+=6;
}else if(cnt!=size-7 || five == "dream" || five == "erase"){
cnt+=5;
}else{
result = "NO";
break;
}
}
// Output
cout << result << endl;
// Fin
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:12: error: 'six' was not declared in this scope; did you mean 'sin'?
25 | if(six == "dreamer" || six == "eraser"){
| ^~~
| sin
|
s267148776 | p03854 | Java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
if( sc.next().length >100000 ){
System.out.println("NO");
return;
}
String s = sc.next();
while(true){
if(s.equals("")){
System.out.println("YES");
return;
}else if( (s.length()>=11)&&(s.substring(0,11).equals("dreameraser"))){
s = s.substring(11);
}else if( (s.length()>=10)&&(s.substring(0,10).equals("dreamerase"))){
s = s.substring(10);
}else if( (s.length()>=7)&&(s.substring(0,7).equals("dreamer"))){
s = s.substring(7);
}else if( (s.length()>=6)&&(s.substring(0,6).equals("eraser"))){
s = s.substring(6);
}else if( (s.length()>=5)&&(s.substring(0,5).equals("dream"))){
s = s.substring(5);
}else if( (s.length()>=5)&&(s.substring(0,5).equals("erase"))){
s = s.substring(5);
}else{
System.out.println("NO");
return;
}
}
}
} | Main.java:7: error: cannot find symbol
if( sc.next().length >100000 ){
^
symbol: variable length
location: class String
1 error
|
s398470424 | p03854 | C++ | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
string t="";
int s_size = s.size();
for (int i=0; i<s_size; ) {
if (i+5 <= s_size && s.substr(i, 5) == "dream") {
t += "dream";
i += 5;
} else if (i+5 <= s_size && s.substr(i, 5) == "erase") {
t += "erase";
i += 5;
} else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
t += "er";
i += 2;
} else if (i+1 <= s_size && s[i] == 'r') {
t += "r";
i += 1;
} else {
break;
}
cout << t << endl;
}
if (s == t) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}
| a.cc:18:51: warning: multi-character character constant [-Wmultichar]
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
a.cc: In function 'int main()':
a.cc:18:48: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>' and 'int')
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ~~~~~~~~~~~~~~ ^~ ~~~~
| | |
| | int
| std::__cxx11::basic_string<char>
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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::fpos<_StateT>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::allocator<_CharT>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::move_iterator<_IteratorL>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::pair<_T1, _T2>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: mismatched types 'const _CharT*' and 'int'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
/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:18:51: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| ^~~~
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:18:51: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::tuple<_UTypes ...>'
18 | } else if (i+2 <= s_size && s.substr(i, 2) == 'er') {
| |
s379389509 | p03854 | C++ | #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define all(a) (a).begin(),(a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define hell 1000000007
#define endl '\n'
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
// cin>>t;
while(t--)
{
int r=0,i;
char a[100001];
cin>>a;
strrev(a);
for(i=0;i<strlen(a);)
{
r=0;
if(a[i]=='m'&&a[i+1]=='a'&&a[i+2]=='e'&&a[i+3]=='r'&&a[i+4]=='d')
{i+=5;r=1;}
if(a[i]=='e'&&a[i+1]=='s'&&a[i+2]=='a'&&a[i+3]=='r'&&a[i+4]=='e')
{i+=5;r=1;}
if(a[i]=='r'&&a[i+1]=='e'&&a[i+2]=='m'&&a[i+3]=='a'&&a[i+4]=='e'&&a[i+5]=='r'&&a[i+6]=='d')
{i+=7;r=1;}
if(a[i]=='r'&&a[i+1]=='e'&&a[i+2]=='s'&&a[i+3]=='a'&&a[i+4]=='r'&&a[i+5]=='e')
{i+=6;r=1;}
if(r==0)
break;
}
cout<<(r!=0?"YES":"NO");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:17: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
26 | strrev(a);
| ^~~~~~
| strsep
|
s581473329 | p03854 | C++ | #include <bits/stdc++.h>
#define rep(i,n) REP(i,0,n)
#define REP(i, a, n) for(int i = a; i < (int)n ; i++)
using namespace std;
string s;
string list[4];
signed main(){
cin >> s;
list[0] = "dream";
list[1] = "dreamer";
list[2] = "erase";
list[3] = "eraser";
int pos;
bool flag = false;
while(s.size()!=0){
flag = false;
rep(i, 4){
if((pos = s.find(list[i], s.size()-list[i].size())) != string::npos){
s.erase(pos, list[i].size());
flag = true;
}
}
if(!flag){
cout << "NO" << '\n';
exit(0);
}
}
cout << "YES" << '\n';
}
| a.cc: In function 'int main()':
a.cc:13:3: error: reference to 'list' is ambiguous
13 | list[0] = "dream";
| ^~~~
In file included from /usr/include/c++/14/list:65,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:150,
from a.cc:1:
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:8: note: 'std::string list [4]'
9 | string list[4];
| ^~~~
a.cc:14:3: error: reference to 'list' is ambiguous
14 | list[1] = "dreamer";
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:8: note: 'std::string list [4]'
9 | string list[4];
| ^~~~
a.cc:15:3: error: reference to 'list' is ambiguous
15 | list[2] = "erase";
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:8: note: 'std::string list [4]'
9 | string list[4];
| ^~~~
a.cc:16:3: error: reference to 'list' is ambiguous
16 | list[3] = "eraser";
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:8: note: 'std::string list [4]'
9 | string list[4];
| ^~~~
a.cc:23:24: error: reference to 'list' is ambiguous
23 | if((pos = s.find(list[i], s.size()-list[i].size())) != string::npos){
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:8: note: 'std::string list [4]'
9 | string list[4];
| ^~~~
a.cc:23:42: error: reference to 'list' is ambiguous
23 | if((pos = s.find(list[i], s.size()-list[i].size())) != string::npos){
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:8: note: 'std::string list [4]'
9 | string list[4];
| ^~~~
a.cc:24:22: error: reference to 'list' is ambiguous
24 | s.erase(pos, list[i].size());
| ^~~~
/usr/include/c++/14/bits/stl_list.h:633:11: note: candidates are: 'template<class _Tp, class _Alloc> class std::__cxx11::list'
633 | class list : protected _List_base<_Tp, _Alloc>
| ^~~~
a.cc:9:8: note: 'std::string list [4]'
9 | string list[4];
| ^~~~
|
s025154454 | p03854 | C++ | #include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cstdio>
using namespace std;
#define NIN(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define NINJ(i,n) for((i)=1;(i)<=(int)(n);(i)++)
#define pb push_back
#define LL long long
#define ff first
#define ss second
#define pp pair<double,double>
#define pt pair<double,pair<int,int>>
int pr[200005];
int fnd(int r)
{
return (pr[r]==r) ? r : pr[r]=fnd(pr[r]);
}
int main()
{
string n;
cin>>n;
int l=n.size();
string s="dream",t="dreamer",x="erase",y="eraser";
int x = l % 5;
if(x==0 || x==2 || x==1)
{
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:42:9: error: conflicting declaration 'int x'
42 | int x = l % 5;
| ^
a.cc:41:34: note: previous declaration as 'std::string x'
41 | string s="dream",t="dreamer",x="erase",y="eraser";
| ^
a.cc:43:9: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
43 | if(x==0 || x==2 || x==1)
| ~^~~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
43 | if(x==0 || x==2 || x==1)
| ^
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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
43 | if(x==0 || x==2 || x==1)
| ^
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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(x==0 || x==2 || x==1)
| ^
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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
43 | if(x==0 || x==2 || x==1)
| ^
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:43:11: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: mismatched types 'const _CharT*' and 'int'
43 | if(x==0 || x==2 || x==1)
| ^
/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:43:11: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
43 | if(x==0 || x==2 || x==1)
| ^
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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
43 | if(x==0 || x==2 || x==1)
| ^
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:43:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
43 | if(x==0 || x==2 || x==1)
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:5:
|
s844405827 | p03855 | C++ | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 100'000'000'7;
//const ll mod = 10000000000ll;
//const ll mod = 10000;
struct mint {
ll x; // typedef long long ll;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
mint operator+(const mint a) const { return mint(*this) += a;}
mint operator-(const mint a) const { return mint(*this) -= a;}
mint operator*(const mint a) const { return mint(*this) *= a;}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
// for prime mod
mint inv() const { return pow(mod-2);}
mint& operator/=(const mint a) { return *this *= a.inv();}
mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define brep(n) for(int bit=0;bit<(1<<n);bit++)
#define bbrep(n) for(int bbit=0;bbit<(1<<n);bbit++)
#define erep(i,container) for (auto &i : container)
#define itrep(i,container) for (auto i : container)
#define irep(i, n) for(ll i = n-1; i >= (ll)0ll; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define repreprep(i,j,k,h,w,n) rep(i,h)rep(j,w)rep(k,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
//#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vout(a) erep(qxqxqx,a)std::cout << qxqxqx << ' ';std::cout << std::endl;
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
//#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<":"
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j);
#define RESRES(a,i,j,k) a.resize(i);rep(ii,i)a[ii].resize(j);reprep(ii,jj,i,j){dp[ii][jj].resize(k)};
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define ppppri(a,b,c,d) std::cout << a<<" "<<b <<" "<< c<<' '<<d<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define SUM(a) accumulate(all(a),0ll)
#define stirng string
#define gin(a,b) int a,b;std::cin >> a>>b;a--;b--;
#define popcount __builtin_popcount
#define permu(a) next_permutation(all(a))
//#define grid_input(a,type) int h,w;std::cin >> h>>w;vvector(a,type,h,w,0);reprep(i,j,h,w)std::cin >> a[i][j];
//typedef long long T;
ll ceil(ll a,ll b){
return ((a+b-1)/b);
}
const int INF = 2000000000;
//const ll INF64 =3223372036854775807ll;
//const ll INF64 = 9223372036854775807ll;
const ll INF64 = 243'000'000'000'000'000'0;
const ll MOD = 100'000'000'7ll;
//const ll MOD = 1000003ll;
const ll OD = 1000000000000007ll;
const dou pi=3.141592653589793;
long long modpow(long long a, long long n) { //累乗の余剰
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % MOD;
a = a * a % MOD;
n >>= 1;
}
return res;
}
//メモ
//ゲーム(Grundy数とか)の復習をする
//群論の勉強をする?
//学会のスライドを治す(木曜日まで)
//周期性の実験をする
//リスニング力をどうにかする
//とりあえずALCはちゃんと埋める(遅延セグ木のやつわかんね~)
//モノイドをやる!!!!
//特に理由がなければllを使おうキャンペーン
//Fenwick Treeのコンストラクタでvectorは使えないので注意
//ランチパスポートを買う
//using mint =modint998244353;
int main(){
int n,k,l;
std::cin >> n>>k>>l;
dsu r(n),t(n);
rep(i,k){
gin(a,b);
r.merge(a,b);
}
rep(i,l){
gin(a,b);
t.merge(a,b);
}
map<P,int>m;
rep(i,n){
m[mp(r.leader(i),t.leader(i))]++;
}
rep(i,n){
std::cout << m[mp(r.leader(i),t.leader(i))] << ' ';
}
std::cout << std::endl;
} | a.cc:5:10: fatal error: atcoder/all: No such file or directory
5 | #include <atcoder/all>
| ^~~~~~~~~~~~~
compilation terminated.
|
s986748951 | p03855 | C++ | // -----------------------------------
// author : MatsuTaku
// country : Japan
// created : 09/03/20 01:08:28
// -----------------------------------
#include <bits/stdc++.h>
#include "../../../library/include/unionfind.hpp"
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr); ios::sync_with_stdio(false);
int n,k,l; cin>>n>>k>>l;
UnionFind cr(n), ct(n);
for (int i = 0; i < k; i++) {
int p,q; cin>>p>>q; p--; q--;
cr.unite(p,q);
}
for (int i = 0; i < l; i++) {
int p,q; cin>>p>>q; p--; q--;
ct.unite(p,q);
}
unordered_map<uint64_t,int> id(n);
for (int i = 0; i < n; i++) {
id[(uint64_t)cr.root(i) << 32 | ct.root(i)]++;
}
for (int i = 0; i < n; i++) {
cout << id[(uint64_t)cr.root(i) << 32 | ct.root(i)] << " ";
}
cout << endl;
return 0;
}
| a.cc:8:10: fatal error: ../../../library/include/unionfind.hpp: No such file or directory
8 | #include "../../../library/include/unionfind.hpp"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s773864640 | p03855 | C++ | #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
class UnionFind {
public:
vector <int> par; // 各元の親を表す配列
vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)
// Constructor
UnionFind(int sz_): par(sz_), siz(sz_, 1) {
for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
}
void init(int sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL); // resize だとなぜか初期化されなかった
for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
}
// Member Function
// Find
int root(int x) { // 根の検索
while (par[x] != x) {
x = par[x] = par[par[x]]; // x の親の親を x の親とする
}
return x;
}
// Union(Unite, Merge)
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return false;
// merge technique(データ構造をマージするテク.小を大にくっつける)
if (siz[x] < siz[y]) swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(int x, int y) { // 連結判定
return root(x) == root(y);
}
int size(int x) { // 素集合のサイズ
return siz[root(x)];
}
};
int main(){
ios::sync_with_stdio(false);
std::cin.tie(0);
int n,k,l;
cin >> n >> k >> l;
UnionFind road(n), rail(n);
while(k--){
int p,q;
cin >> p >> q;
p--;
q--;
road.merge(p,q);
}
while(l--){
int r,s;
cin >> r >> s;
r--;
s--;
rail.merge(r,s);
}
rep(i,n){
int cnt = 0;
rep(j,n){
if(road.issame(i,j) && rail.issame(i,j))cnt++;
}
cout << cnt << " ";
}
return 0;
}
| a.cc:55:1: error: extended character is not valid in an identifier
55 | std::cin.tie(0);
| ^
a.cc: In function 'int main()':
a.cc:55:1: error: '\U00003000std' has not been declared
55 | std::cin.tie(0);
| ^~~~~
|
s538610600 | p03855 | C++ | #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
class UnionFind {
public:
vector <int> par; // 各元の親を表す配列
vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)
// Constructor
UnionFind(int sz_): par(sz_), siz(sz_, 1) {
for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
}
void init(int sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL); // resize だとなぜか初期化されなかった
for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
}
// Member Function
// Find
int root(int x) { // 根の検索
while (par[x] != x) {
x = par[x] = par[par[x]]; // x の親の親を x の親とする
}
return x;
}
// Union(Unite, Merge)
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return false;
// merge technique(データ構造をマージするテク.小を大にくっつける)
if (siz[x] < siz[y]) swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(int x, int y) { // 連結判定
return root(x) == root(y);
}
int size(int x) { // 素集合のサイズ
return siz[root(x)];
}
};
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n,k,l;
cin >> n >> k >> l;
UnionFind road(n), rail(n);
while(k--){
int p,q;
cin >> p >> q;
p--;
q--;
road.merge(p,q);
}
while(l--){
int r,s;
cin >> r >> s;
r--;
s--;
rail.merge(r,s);
}
rep(i,n){
int cnt = 0;
rep(j,n){
if(road.issame(i,j) && rail.issame(i,j))cnt++;
}
cout << cnt << " ";
}
return 0;
}
| a.cc:55:1: error: extended character is not valid in an identifier
55 | std::cin.tie(nullptr);
| ^
a.cc: In function 'int main()':
a.cc:55:1: error: '\U00003000std' has not been declared
55 | std::cin.tie(nullptr);
| ^~~~~
|
s455569877 | p03855 | C++ | #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
class UnionFind {
public:
vector <int> par; // 各元の親を表す配列
vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)
// Constructor
UnionFind(int sz_): par(sz_), siz(sz_, 1) {
for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
}
void init(int sz_) {
par.resize(sz_);
siz.assign(sz_, 1LL); // resize だとなぜか初期化されなかった
for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
}
// Member Function
// Find
int root(ll x) { // 根の検索
while (par[x] != x) {
x = par[x] = par[par[x]]; // x の親の親を x の親とする
}
return x;
}
// Union(Unite, Merge)
bool merge(int x, int y) {
x = root(x);
y = root(y);
if (x == y) return false;
// merge technique(データ構造をマージするテク.小を大にくっつける)
if (siz[x] < siz[y]) swap(x, y);
siz[x] += siz[y];
par[y] = x;
return true;
}
bool issame(int x, int y) { // 連結判定
return root(x) == root(y);
}
int size(int x) { // 素集合のサイズ
return siz[root(x)];
}
};
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n,k,l;
cin >> n >> k >> l;
UnionFind road(n), rail(n);
while(k--){
int p,q;
cin >> p >> q;
p--;
q--;
road.merge(p,q);
}
while(l--){
int r,s;
cin >> r >> s;
r--;
s--;
rail.merge(r,s);
}
rep(i,n){
int cnt = 0;
rep(j,n){
if(road.issame(i,j) && rail.issame(i,j))cnt++;
}
cout << cnt << " ";
}
return 0;
}
| a.cc:55:1: error: extended character is not valid in an identifier
55 | std::cin.tie(nullptr);
| ^
a.cc:25:14: error: 'll' has not been declared
25 | int root(ll x) { // 根の検索
| ^~
a.cc: In function 'int main()':
a.cc:55:1: error: '\U00003000std' has not been declared
55 | std::cin.tie(nullptr);
| ^~~~~
|
s044445377 | p03855 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s531631432 | p03855 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int s1[N],s2[N],a[N];
int find(int x,int *s){
return x==s[x]?x:s[x]=find(s[x]);
}
int main(){
int n,k,l;
scanf("%d%d%d",&n,&k,&l);
for(int i=1;i<=n;i++) s[i]=i,a[i]=1;
for(int i=1;i<=k;i++){
int u,v;
scanf("%d%d",&u,&v);
int fu=find(u,s1),fv=find(v,s1);
if(fu!=fv) s1[fu]=fv;
}
for(int i=1;i<=l;i++){
int u,v;
scanf("%d%d",&u,&v);
int fu=find(u,s2),fv=find(v,s2);
if(fu!=fv) s2[fu]=fv;
}
unordered_map<PII,int>mp;
for(int i=1;i<=n;i++){
mp[make_pair(find(i,s1),find(i,s2))]++;
}
for(int i=1;i<=n;i++)
printf("%d ",mp[make_pair(s1[i],s2[i])]);
return 0;
}
| a.cc: In function 'int find(int, int*)':
a.cc:16:35: error: no matching function for call to 'find(int&)'
16 | return x==s[x]?x:s[x]=find(s[x]);
| ~~~~^~~~~~
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:3842:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
3842 | find(_InputIterator __first, _InputIterator __last,
| ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate expects 4 arguments, 1 provided
In file included from /usr/include/c++/14/iterator:66,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate expects 3 arguments, 1 provided
a.cc:15:5: note: candidate: 'int find(int, int*)'
15 | int find(int x,int *s){
| ^~~~
a.cc:15:5: note: candidate expects 2 arguments, 1 provided
a.cc: In function 'int main()':
a.cc:21:31: error: 's' was not declared in this scope
21 | for(int i=1;i<=n;i++) s[i]=i,a[i]=1;
| ^
a.cc:34:31: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]'
34 | unordered_map<PII,int>mp;
| ^~
In file included from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' is implicitly deleted because the default definition would be ill-formed:
148 | unordered_map() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h: At global scope:
/usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
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:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashta |
s658564961 | p03855 | C++ | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
const int mod = 1000000007;
struct UnionFind {
vector<int> par;
UnionFind(int n)
: par(n, -1)
{
}
void init(int n) { par.assign(n, -1); }
int root(int x)
{
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(int x, int y)
{
return root(x) == root(y);
}
bool merge(int x, int y)
{
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
int size(int x)
{
return -par[root(x)];
}
};
int main()
{
in N, K, L;
cin >> N >> K >> L;
UnionFind uf(N), uf2(N);
for (int i = 0; i < K; i++) {
int a, b;
cin >> a >> b;
--a, --b;
uf1.merge(a, b);
}
for (int i = 0; i < L; i++) {
int a, b;
cin >> a >> b;
--a, --b;
uf2.merge(a, b);
}
using pint = pair<int, int>;
map<pint, int> ma;
for (int v = 0; v < N; v++) {
pint p(uf1.root(v), uf2.root(v));
ma[p]++;
}
for (int v = 0; v < N; v++) {
pint p(uf1.root(v), uf2.root(v));
cout << ma[p] << " ";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:61:5: error: 'in' was not declared in this scope; did you mean 'yn'?
61 | in N, K, L;
| ^~
| yn
a.cc:62:12: error: 'N' was not declared in this scope
62 | cin >> N >> K >> L;
| ^
a.cc:62:17: error: 'K' was not declared in this scope
62 | cin >> N >> K >> L;
| ^
a.cc:62:22: error: 'L' was not declared in this scope
62 | cin >> N >> K >> L;
| ^
a.cc:68:9: error: 'uf1' was not declared in this scope; did you mean 'uf2'?
68 | uf1.merge(a, b);
| ^~~
| uf2
a.cc:80:16: error: 'uf1' was not declared in this scope; did you mean 'uf2'?
80 | pint p(uf1.root(v), uf2.root(v));
| ^~~
| uf2
a.cc:84:16: error: 'uf1' was not declared in this scope; did you mean 'uf2'?
84 | pint p(uf1.root(v), uf2.root(v));
| ^~~
| uf2
|
s576238639 | p03855 | C++ | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
const int mod = 1000000007;
struct UnionFind {
vector<int> par;
UnionFind(int n)
: par(n, -1)
{
}
void init(int n) { par.assign(n, -1); }
int root(int x)
{
if (par[x] < 0)
return x;
else
return par[x] = root(par[x]);
}
bool issame(int x, int y)
{
return root(x) == root(y);
}
bool merge(int x, int y)
{
x = root(x);
y = root(y);
if (x == y)
return false;
if (par[x] > par[y])
swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
int size(int x)
{
return -par[root(x)];
}
};
int main()
{
in N, K, L;
cin >> N >> K >> L;
UnionFind urf(N), urf2(N);
for (int i = 0; i < K; i++) {
int a, b;
cin >> a >> b;
--a, --b;
uf1.merge(a, b);
}
for (int i = 0; i < L; i++) {
int a, b;
cin >> a >> b;
--a, --b;
uf2.merge(a, b);
}
using pint = pair<int, int>;
map<pint, int> ma;
for (int v = 0; v < N; v++) {
pint p(uf1.root(v), uf2.root(v));
ma[p]++;
}
for (int v = 0; v < N; v++) {
pint p(uf1.root(v), uf2.root(v));
cout << ma[p] << " ";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:61:5: error: 'in' was not declared in this scope; did you mean 'yn'?
61 | in N, K, L;
| ^~
| yn
a.cc:62:12: error: 'N' was not declared in this scope
62 | cin >> N >> K >> L;
| ^
a.cc:62:17: error: 'K' was not declared in this scope
62 | cin >> N >> K >> L;
| ^
a.cc:62:22: error: 'L' was not declared in this scope
62 | cin >> N >> K >> L;
| ^
a.cc:68:9: error: 'uf1' was not declared in this scope
68 | uf1.merge(a, b);
| ^~~
a.cc:74:9: error: 'uf2' was not declared in this scope; did you mean 'urf2'?
74 | uf2.merge(a, b);
| ^~~
| urf2
a.cc:80:16: error: 'uf1' was not declared in this scope
80 | pint p(uf1.root(v), uf2.root(v));
| ^~~
a.cc:80:29: error: 'uf2' was not declared in this scope; did you mean 'urf2'?
80 | pint p(uf1.root(v), uf2.root(v));
| ^~~
| urf2
a.cc:84:16: error: 'uf1' was not declared in this scope
84 | pint p(uf1.root(v), uf2.root(v));
| ^~~
a.cc:84:29: error: 'uf2' was not declared in this scope; did you mean 'urf2'?
84 | pint p(uf1.root(v), uf2.root(v));
| ^~~
| urf2
|
s171048920 | p03855 | C++ | import collections
NO_OF_DIMENSIONS = 2
no_of_edges_by_dim = [0] * NO_OF_DIMENSIONS
n, no_of_edges_by_dim[0], no_of_edges_by_dim[1] = (int(x) for x in input().split())
graph_by_dimension = [[[] for _ in range(n + 1)] for _ in range(NO_OF_DIMENSIONS)]
for dimension, no_of_edges in enumerate(no_of_edges_by_dim):
graph = graph_by_dimension[dimension]
for _ in range(no_of_edges):
p, q = (int(x) for x in input().split())
graph[p].append(q)
graph[q].append(p)
components_ids_by_vertex = [[None] * NO_OF_DIMENSIONS for _ in range(n + 1)]
def dfs(dimension_id, vertex_id, colour):
components_ids_by_vertex[vertex_id][dimension_id] = colour
for s in graph_by_dimension[dimension_id][vertex_id]:
if not components_ids_by_vertex[s][dimension_id]:
dfs(dimension_id, s, colour)
for i in range(NO_OF_DIMENSIONS):
for j in range(1, n + 1):
if not components_ids_by_vertex[j][i]:
dfs(i, j, j)
components_ids_by_vertex = [tuple(x) for x in components_ids_by_vertex]
results = collections.Counter(components_ids_by_vertex)
for i in range(1, n + 1):
print(results[components_ids_by_vertex[i]], end=' ')
print()
| a.cc:1:1: error: 'import' does not name a type
1 | import collections
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s881148439 | p03855 | C++ | #include <iostream>
using namespace std;
constexpr int nax = 2e5, no_of_dims = 2;
int n, siz[no_of_dims], id[no_of_dims][nax + 1];
array< int, no_of_dims > spoj[nax + 1];
vector< int > gr[no_of_dims][nax + 1];
bool operator<(const array< int, no_of_dims >& mn, const array< int, no_of_dims >& wc)
{
for (int i = 0; i < no_of_dims; ++i)
if (mn[i] < wc[i])
return true;
return false;
}
bool operator==(const array< int, no_of_dims >& a, const array< int, no_of_dims >& b)
{
for (int i = 0; i < no_of_dims; ++i)
if (a[i] != b[i])
return false;
return true;
}
void dfs(const int d, const int v, const int c)
{
spoj[v][d] = c;
for (int s : gr[d][v])
if (not spoj[s][d])
dfs(d, s, c);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 0; i < no_of_dims; ++i)
cin >> siz[i];
for (int i = 0; i < no_of_dims; ++i)
for (int j = 0; j < siz[i]; ++j)
{
int p, q; cin >> p >> q;
gr[i][p].push_back(q);
gr[i][q].push_back(p);
}
for (int i = 0; i < no_of_dims; ++i)
for (int j = 1; j <= n; ++j)
if (not spoj[j][i])
dfs(i, j, j);
sort(begin(spoj) + 1, begin(spoj) + n + 1);
int current = 0;
long long result = 0;
for (int i = 1; i <= n; ++i)
{
if (i == 1 or spoj[i] == spoj[i - 1])
++current;
else
{
result += (ll)current * (current - 1) / 2;
current = 1;
}
}
result += (ll)current * (current - 1) / 2;
cout << result << '\n';
}
| a.cc:7:26: error: elements of array 'std::array<int, 2> spoj [200001]' have incomplete type
7 | array< int, no_of_dims > spoj[nax + 1];
| ^~~~
a.cc:7:26: error: storage size of 'spoj' isn't known
a.cc:8:1: error: 'vector' does not name a type
8 | vector< int > gr[no_of_dims][nax + 1];
| ^~~~~~
a.cc: In function 'bool operator<(const std::array<int, 2>&, const std::array<int, 2>&)':
a.cc:13:15: error: no match for 'operator[]' (operand types are 'const std::array<int, 2>' and 'int')
13 | if (mn[i] < wc[i])
| ^
a.cc:13:23: error: no match for 'operator[]' (operand types are 'const std::array<int, 2>' and 'int')
13 | if (mn[i] < wc[i])
| ^
a.cc: In function 'bool operator==(const std::array<int, 2>&, const std::array<int, 2>&)':
a.cc:21:14: error: no match for 'operator[]' (operand types are 'const std::array<int, 2>' and 'int')
21 | if (a[i] != b[i])
| ^
a.cc:21:22: error: no match for 'operator[]' (operand types are 'const std::array<int, 2>' and 'int')
21 | if (a[i] != b[i])
| ^
a.cc: In function 'void dfs(int, int, int)':
a.cc:29:18: error: 'gr' was not declared in this scope
29 | for (int s : gr[d][v])
| ^~
a.cc: In function 'int main()':
a.cc:47:13: error: 'gr' was not declared in this scope
47 | gr[i][p].push_back(q);
| ^~
a.cc:56:5: error: 'sort' was not declared in this scope; did you mean 'short'?
56 | sort(begin(spoj) + 1, begin(spoj) + n + 1);
| ^~~~
| short
a.cc:66:24: error: 'll' was not declared in this scope
66 | result += (ll)current * (current - 1) / 2;
| ^~
a.cc:71:16: error: 'll' was not declared in this scope
71 | result += (ll)current * (current - 1) / 2;
| ^~
|
s752437186 | p03855 | C++ | #pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };
struct UnionFind{
private:
vector<int> par;
vector<int> siz;
public:
void init(int N){
par.resize(N);
siz.resize(N);
for(int i=0; i<N; i++) par[i] = i;
for(int i=0; i<N; i++) siz[i] = 1;
}
void unite(int a, int b){
int rootA = root(a);
int rootB = root(b);
if(rootA == rootB) return;
if(siz[rootA] < siz[rootB]) swap(rootA, rootB);
par[rootB] = rootA;
siz[rootA] += siz[rootB];
}
int root(int a){
if(par[a] == a) return a;
return par[a] = root(par[a]);
}
bool same(int a, int b){
return root(a) == root(b);
}
int size(int a){
return siz[root(a)];
}
};
int N, K, L;
UnionFind uf1, uf2;
unordered_map<pair<int, int>, int> t;
signed main(){
cin >> N >> K >> L;
uf1.init(N);
rep(i, K){
int a, b;
cin >> a >> b;
uf1.unite(a-1, b-1);
}
uf2.init(N);
rep(i, L){
int a, b;
cin >> a >> b;
uf2.unite(a-1, b-1);
}
rep(i, N){
t[mp(uf1.root(i), uf2.root(i))]++;
}
rep(i, N){
cout << t[mp(uf1.root(i), uf2.root(i))] << endl;
}
} | a.cc:51:36: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]'
51 | unordered_map<pair<int, int>, int> t;
| ^
In file included from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:4:
/usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' is implicitly deleted because the default definition would be ill-formed:
148 | unordered_map() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
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:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()'
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed:
1306 | struct _Hash_code_base
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<const std::p |
s725317476 | p03855 | C++ | #include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;
struct UnionFind {
vector<int> par,rank,large;
void init(int N){
rank.assign(N,0);
large.assign(N,1);
par.resize(N);
for(int i= 0; i < N; i++){
par[i]=i;
}
}
int root(int x) {
if (par[x] == x) return x;
return par[x] = root(par[x]);
}
void unite(int x, int y) {
int rx = root(x);
int ry = root(y);
if (rx == ry) return;
if(rank[rx]<rank[ry]) {
par[rx]=ry;
large[ry]+=large[rx];
large[rx]=0;
}
else {
par[ry]=rx;
large[rx]+=large[ry];
large[ry]=0;
if(rank[rx]==rank[ry])rank[x]++;
}
}
bool same(int x, int y) {
int rx = root(x);
int ry = root(y);
return rx == ry;
}
int size(int x) {
return large[root(x)];
}
};
int main() {
int N,K,L;
cin>>N>>K>>L;
UnionFind A,B,C;
A.init(N);
B.init(N);
C.init(N)
for(int i = 0; i < K; i++){
ll x,y;
cin>>x>>y;
A.unite(x-1,y-1);
}
for(int i = 0; i < L; i++){
ll x,y;
cin>>x>>y;
if(A.same(x-1,y-1)) C.unite(x-1,y-1);
}
for(int i = 0; i < N; i++){
cout<<C.size(i)<<" ";
}
cout<<endl;
} | a.cc: In function 'int main()':
a.cc:65:12: error: expected ';' before 'for'
65 | C.init(N)
| ^
| ;
66 | for(int i = 0; i < K; i++){
| ~~~
a.cc:66:18: error: 'i' was not declared in this scope
66 | for(int i = 0; i < K; i++){
| ^
|
s368241542 | p03855 | C++ | tes | a.cc:1:1: error: 'tes' does not name a type
1 | tes
| ^~~
|
s237674686 | p03855 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
struct UnionFind{
vector<int>p;
UnionFind(int n){
p.resize(n, -1);
}
void unite(int x, int y){
x = find(x);
y = find(y);
if (x == y) return;
if (x < y) swap(x,y);
p[x] = y;
}
int find(int x){
if (p[x] == -1) return x;
else return p[x] = find(p[x]);
}
};
int main() {
int N, K, L;
cin >> N >> K >> L;
UnionFind Road(N);
UnionFind Train(N);
for (int i=0; i<K; i++){
int pi, qi;
cin >> pi >> qi;
Road.unite(pi-1,qi-1);
}
for (int i=0; i<L; i++){
int ri, si;
cin >> ri >> si;
Train.unite(ri-1, si-1);
}
map<pair<int,int>, int>mp;
for (int i=0; i<N; i++){
pair<int,int>pr;
pr.first = Road.find(i);
pr.second = Train.find(i);
mp[pr]++;
}
for (int i=0; i<N; i++){
pair<int, int>pr;
pr.first = Road.find(i);
pr.second = Train.find(i);
cout << mp[pr] << endl;
}
| a.cc: In function 'int main()':
a.cc:62:6: error: expected '}' at end of input
62 | }
| ^
a.cc:30:12: note: to match this '{'
30 | int main() {
| ^
|
s142011555 | p03855 | Java | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class D49 {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve()
{
int N = ni();
int K = ni();
int L = ni();
UnionFind tree1 = new UnionFind(N);
UnionFind tree2 = new UnionFind(N);
for (int i = 0; i < K; i++) {
int p = ni();
int q = ni();
tree1.union(p - 1, q - 1);
}
for (int i = 0; i < L; i++) {
int r = ni();
int s = ni();
tree2.union(r - 1, s - 1);
}
TreeMap<Long, Integer> count = new TreeMap<>();
for (int i = 0; i < N; i++) {
long key = (long) tree1.find(i) * N + tree2.find(i);
Integer cnt = count.get(key);
if (cnt == null) count.put(key, 1);
else count.put(key, cnt + 1);
}
for (int i = 0; i < N; i++) {
if (i > 0) out.print(" ");
long key = (long) tree1.find(i) * N + tree2.find(i);
out.print(count.get(key));
}
out.println("");
}
public static void main(String[] args) throws Exception
{
long S = System.currentTimeMillis();
is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
out = new PrintWriter(System.out);
solve();
out.flush();
long G = System.currentTimeMillis();
tr(G-S+"ms");
}
private static boolean eof()
{
if(lenbuf == -1)return true;
int lptr = ptrbuf;
while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false;
try {
is.mark(1000);
while(true){
int b = is.read();
if(b == -1){
is.reset();
return true;
}else if(!isSpaceChar(b)){
is.reset();
return false;
}
}
} catch (IOException e) {
return true;
}
}
private static byte[] inbuf = new byte[1024];
static int lenbuf = 0, ptrbuf = 0;
private static int readByte()
{
if(lenbuf == -1)throw new InputMismatchException();
if(ptrbuf >= lenbuf){
ptrbuf = 0;
try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
if(lenbuf <= 0)return -1;
}
return inbuf[ptrbuf++];
}
private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
private static double nd() { return Double.parseDouble(ns()); }
private static char nc() { return (char)skip(); }
private static String ns()
{
int b = skip();
StringBuilder sb = new StringBuilder();
while(!(isSpaceChar(b))){
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
private static char[] ns(int n)
{
char[] buf = new char[n];
int b = skip(), p = 0;
while(p < n && !(isSpaceChar(b))){
buf[p++] = (char)b;
b = readByte();
}
return n == p ? buf : Arrays.copyOf(buf, p);
}
private static char[][] nm(int n, int m)
{
char[][] map = new char[n][];
for(int i = 0;i < n;i++)map[i] = ns(m);
return map;
}
private static int[] na(int n)
{
int[] a = new int[n];
for(int i = 0;i < n;i++)a[i] = ni();
return a;
}
private static int ni()
{
int num = 0, b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static long nl()
{
long num = 0;
int b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
public static class UnionFind {
private int count = 0;
private int[] parent, rank;
public UnionFind(int n) {
count = n;
parent = new int[n];
rank = new int[n];
for (int i = 0; i < n; i++) {
parent[i] = i;
}
}
public int find(int p) {
while (p != parent[p]) {
parent[p] = parent[parent[p]];
p = parent[p];
}
return p;
}
public void union(int p, int q) {
int rootP = find(p);
int rootQ = find(q);
if (rootP ==rootQ) return;
if (rank[rootQ] > rank[rootP]) {
parent[rootP] = rootQ;
} else {
parent[rootQ] = rootP;
if (rank[rootP] == rank[rootQ]) {
rank[rootP]++;
}
}
count--;
}
public int count() {
return count;
}
}
}
| Main.java:7: error: class D49 is public, should be declared in a file named D49.java
public class D49 {
^
1 error
|
s215244219 | p03855 | Java | import javafx.util.Pair;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve()
{
int N = ni();
int K = ni();
int L = ni();
UnionFind tree1 = new UnionFind(N);
UnionFind tree2 = new UnionFind(N);
for (int i = 0; i < K; i++) {
int p = ni();
int q = ni();
tree1.union(p - 1, q - 1);
}
for (int i = 0; i < L; i++) {
int r = ni();
int s = ni();
tree2.union(r - 1, s - 1);
}
TreeMap<Long, Integer> count = new TreeMap<>();
for (int i = 0; i < N; i++) {
long key = (long) tree1.find(i) * N + tree2.find(i);
Integer cnt = count.get(key);
if (cnt == null) count.put(key, 1);
else count.put(key, cnt + 1);
}
for (int i = 0; i < N; i++) {
if (i > 0) out.print(" ");
long key = (long) tree1.find(i) * N + tree2.find(i);
out.print(count.get(key));
}
out.println("");
}
public static void main(String[] args) throws Exception
{
long S = System.currentTimeMillis();
is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
out = new PrintWriter(System.out);
solve();
out.flush();
long G = System.currentTimeMillis();
tr(G-S+"ms");
}
private static boolean eof()
{
if(lenbuf == -1)return true;
int lptr = ptrbuf;
while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false;
try {
is.mark(1000);
while(true){
int b = is.read();
if(b == -1){
is.reset();
return true;
}else if(!isSpaceChar(b)){
is.reset();
return false;
}
}
} catch (IOException e) {
return true;
}
}
private static byte[] inbuf = new byte[1024];
static int lenbuf = 0, ptrbuf = 0;
private static int readByte()
{
if(lenbuf == -1)throw new InputMismatchException();
if(ptrbuf >= lenbuf){
ptrbuf = 0;
try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
if(lenbuf <= 0)return -1;
}
return inbuf[ptrbuf++];
}
private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
private static double nd() { return Double.parseDouble(ns()); }
private static char nc() { return (char)skip(); }
private static String ns()
{
int b = skip();
StringBuilder sb = new StringBuilder();
while(!(isSpaceChar(b))){
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
private static char[] ns(int n)
{
char[] buf = new char[n];
int b = skip(), p = 0;
while(p < n && !(isSpaceChar(b))){
buf[p++] = (char)b;
b = readByte();
}
return n == p ? buf : Arrays.copyOf(buf, p);
}
private static char[][] nm(int n, int m)
{
char[][] map = new char[n][];
for(int i = 0;i < n;i++)map[i] = ns(m);
return map;
}
private static int[] na(int n)
{
int[] a = new int[n];
for(int i = 0;i < n;i++)a[i] = ni();
return a;
}
private static int ni()
{
int num = 0, b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static long nl()
{
long num = 0;
int b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
public static class UnionFind {
private int count = 0;
private int[] parent, rank;
public UnionFind(int n) {
count = n;
parent = new int[n];
rank = new int[n];
for (int i = 0; i < n; i++) {
parent[i] = i;
}
}
public int find(int p) {
while (p != parent[p]) {
parent[p] = parent[parent[p]];
p = parent[p];
}
return p;
}
public void union(int p, int q) {
int rootP = find(p);
int rootQ = find(q);
if (rootP ==rootQ) return;
if (rank[rootQ] > rank[rootP]) {
parent[rootP] = rootQ;
} else {
parent[rootQ] = rootP;
if (rank[rootP] == rank[rootQ]) {
rank[rootP]++;
}
}
count--;
}
public int count() {
return count;
}
}
}
| Main.java:1: error: package javafx.util does not exist
import javafx.util.Pair;
^
1 error
|
s572535581 | p03855 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <numeric>
#include <cmath>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()
const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;
struct union_find{
vector<int> par,r;
union_find(int n){
par.resize(n);
r.resize(n);
for(int i = 0; i < n; i++) par[i] = i,r[i] = 0;
}
int find(int x){
if(par[x] == x) return x;
else return find(par[x]);
}
void unite(int x,int y){
x = find(x);
y = find(y);
if(r[x] < r[y]){
par[x] = y;
}else{
par[y] = x;
if(r[x] == r[y]) r[x]++;
}
}
bool same(int x,int y){
return find(x) == find(y);
}
};
int main()
{
int n,k,l;
cin >> n >> k >> l;
union_find road(n),train(n);
for(int i = 0; i < k; i++){
int a,b;
cin >> a >> b;
a--,b--;
if(!road.same(a,b)) road.unite(a,b);
}
for(int i = 0; i < l; i++){
int a,b;
cin >> a >> b;
a--,b--;
if(!train.same(a,b)) train.unite(a,b);
}
vector<pair<int,int> > com(n);
map<pair<int,int> ,int> s;
for(int i = 0; i < n; i++){
com[i].first = road.find(i);
com[i].second = train.find(i);
s[com[i]]++;
}
for(int i = 0; i < n; i++){
cout << s[com[i]] << " "
}printf("\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:79:41: error: expected ';' before '}' token
79 | cout << s[com[i]] << " "
| ^
| ;
80 | }printf("\n");
| ~
|
s629151316 | p03855 | C++ | #include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
typedef long long ll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;
class UnionFind{
vector<int> par; vector<int> rank;
public:
UnionFind(int N) : par(N),rank(N){
for(int i=0; i<N; ++i){ par[i] = i; rank[i] = 0; }
}
int find(int x){
if(par[x] == x)return x;
return par[x]=find(par[x]);
}
//xとyとが所属する集合を併呑する
void unite(int x,int y){
int rx = find(x); int ry = find(y);
if(rx == ry) return;
if(rank[x]<rank[y]){
par[rx] = ry;
}else{
par[ry] = rx;
if(rank[rx] == rank[ry])rank[rx]++;
}
}
bool same(int x, int y){
int ry = find(x); int rx = find(y);
return rx == ry;
}
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);/
int n,k,l; cin>>n>>k>>l; int p,q;
UnionFind road(n); rep(i,k){ cin>>p>>q; road.unite(--p,--q); }
UnionFind rail(n); rep(i,l){ cin>>p>>q; rail.unite(--p,--q); }
rep(i,n){
int ans = 1;
rep(j,n){
if(i!=j){
if(road.same(i,j) && rail.same(i,j))++ans;
}
}
cout<< ans <<' ';
}
}
| a.cc: In function 'int main()':
a.cc:54:33: error: expected primary-expression before '/' token
54 | ios::sync_with_stdio(false);/
| ^
a.cc:56:5: error: expected primary-expression before 'int'
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^~~
a.cc:56:21: error: 'n' was not declared in this scope; did you mean 'yn'?
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^
| yn
a.cc:56:24: error: 'k' was not declared in this scope
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^
a.cc:56:27: error: 'l' was not declared in this scope; did you mean 'll'?
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^
| ll
|
s213806603 | p03855 | C++ | #include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
typedef long long ll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;
class UnionFind{
vector<int> par; vector<int> rank;
public:
UnionFind(int N) : par(N),rank(N){
for(int i=0; i<N; ++i){ par[i] = i; rank[i] = 0; }
}
int find(int x){
if(par[x] == x)return x;
return par[x]=find(par[x]);
}
//xとyとが所属する集合を併呑する
void unite(int x,int y){
int rx = find(x); int ry = find(y);
if(rx == ry) return;
if(rank[x]<rank[y]){
par[rx] = ry;
}else{
par[ry] = rx;
if(rank[rx] == rank[ry])rank[rx]++;
}
}
bool same(int x, int y){
int ry = find(x); int rx = find(y);
return rx == ry;
}
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);/
int n,k,l; cin>>n>>k>>l; int p,q;
UnionFind road(n); rep(i,k){ cin>>p>>q; road.unite(--p,--q); }/
UnionFind rail(n); rep(i,l){ cin>>p>>q; rail.unite(--p,--q); }/
rep(i,n){
int ans = 1;
rep(j,n){
if(i!=j){
if(road.same(i,j) && rail.same(i,j))++ans;
}
}
cout<< ans <<' ';
}
}
| a.cc: In function 'int main()':
a.cc:54:33: error: expected primary-expression before '/' token
54 | ios::sync_with_stdio(false);/
| ^
a.cc:56:5: error: expected primary-expression before 'int'
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^~~
a.cc:56:21: error: 'n' was not declared in this scope; did you mean 'yn'?
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^
| yn
a.cc:56:24: error: 'k' was not declared in this scope
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^
a.cc:56:27: error: 'l' was not declared in this scope; did you mean 'll'?
56 | int n,k,l; cin>>n>>k>>l; int p,q;
| ^
| ll
a.cc:57:67: error: expected primary-expression before '/' token
57 | UnionFind road(n); rep(i,k){ cin>>p>>q; road.unite(--p,--q); }/
| ^
a.cc:58:15: error: expected primary-expression before 'rail'
58 | UnionFind rail(n); rep(i,l){ cin>>p>>q; rail.unite(--p,--q); }/
| ^~~~
a.cc:58:45: error: 'rail' was not declared in this scope
58 | UnionFind rail(n); rep(i,l){ cin>>p>>q; rail.unite(--p,--q); }/
| ^~~~
a.cc:58:67: error: expected primary-expression before '/' token
58 | UnionFind rail(n); rep(i,l){ cin>>p>>q; rail.unite(--p,--q); }/
| ^
a.cc:15:18: error: expected primary-expression before 'for'
15 | #define rep(i,n) for(int i = 0; i<n; ++i)
| ^~~
a.cc:60:5: note: in expansion of macro 'rep'
60 | rep(i,n){
| ^~~
a.cc:60:9: error: 'i' was not declared in this scope
60 | rep(i,n){
| ^
a.cc:15:33: note: in definition of macro 'rep'
15 | #define rep(i,n) for(int i = 0; i<n; ++i)
| ^
|
s043803569 | p03855 | C++ | 1 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1
| ^
|
s557798361 | p03855 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef pair<int,int> P;
int par[400100],Rank[400100];
int n,k,l;
void init(int n){
for(int i=0; i<n; i++){
par[i]=i;
Rank[i]=0;
}
}
int find(int x){
if(par[x]==x) return x;
else return par[x]=find(par[x]);
}
void unite(int x,int y){
x=find(x);
y=find(y);
if(x==y) return;
if(Rank[x]<Rank[y]) swap(x,y);
Rank[x]+=Rank[y];
par[y]=a;
}
bool same(int x,int y){
return find(x)==find(y);
}
int main() {
cin >> n >> k >> l;
vector<P> c(n);
map<P,int> mp;
init(2*n);
for(int i=0; i<k; i++){
int p,q;
cin >> p >> q;
p--;q--;
unite(p,q);
}
for(int i=0; i<l; i++){
int r,s;
cin >> r >> s;
r--;s--;
unite(r+n,s+n);
}
for(int i=0; i<n; i++){
c[i]=P(par[i],par[i+n]);
mp[P(par[i],par[i+n])]++;
}
for(int i=0; i<n; i++){
cout << mp[c[i]] << " ";
}
cout << endl;
return 0;
} | a.cc: In function 'void unite(int, int)':
a.cc:23:12: error: 'a' was not declared in this scope
23 | par[y]=a;
| ^
|
s477315896 | p03855 | C++ | #include<bits/stdc++.h>
using namespace std;
struct UF {
vector<int> p;
UF(int n) : p(n, -1) {}
int r(int x) {
if (p[x] < 0) return x;
return p[x] = r(p[x]);
}
void m(int x, int y) {
x = r(x); y = r(y);
if (x == y) continue;
if (-p[x] > -p[y]) swap(x, y);
p[y] += p[x];
p[x] = y;
}
};
int main() {
int n, k, l; cin >> n >> k >> l;
UF a(n), b(n);
while (k--) {
int f, t; cin >> f >> t; f--; t--;
a.m(f, t);
}
while (l--) {
int f, t; cin >> f >> t; f--; t--;
b.m(f, t);
}
map<pair<int, int>, int> m;
for (int i = 0; i < n; i++) {
m[{a.r(i), b.r(i)}]++;
}
for (int i = 0; i < n; i++) {
cout << m[{a.r(i), b.r(i)}] << endl;
}
} | a.cc: In member function 'void UF::m(int, int)':
a.cc:12:17: error: continue statement not within a loop
12 | if (x == y) continue;
| ^~~~~~~~
|
s721885828 | p03855 | C++ | #include<bits/stdc++.h>
using namespace std;
struct UF {
vector<int> p;
UF(int n) : p(n) {iota(p.begin(), p.end(), 0);}
int r(int x) {
if (p[x] == 0) return x;
return p[x] = root(p[x]);
}
void m(int x, int y) {
x = r(x); y = r(y);
p[x] = y;
}
};
int main() {
int n, k, l; cin >> n >> k >> l;
UF a(n), b(n);
while (k--) {
int f, t; cin >> f >> t; f--; t--;
a.m(f, t);
}
while (l--) {
int f, t; cin >> f >> t; f--; t--;
b.m(f, t);
}
map<pair<int, int>, int> m;
for (int i = 0; i < n; i++) {
m[{a.r(i), b.r(i)}]++;
}
for (int i = 0; i < n; i++) {
cout << m[{a.r(i), b.r(i)}] << endl;
}
} | a.cc: In member function 'int UF::r(int)':
a.cc:8:19: error: 'root' was not declared in this scope
8 | return p[x] = root(p[x]);
| ^~~~
|
s580088802 | p03855 | C++ | #include <bits/stdc++.h>
using namespace std;
struct UnionFind
{
vector<int> data;
UnionFind(int sz)
{
data.assign(sz,-1);
}
bool unite(int x, int y)
{
x = find(x), y = find(y);
if(x == y) return(false);
if(data[x] > data[y]) swap(x,y);
data[x] += data[y];
data[y] = x;
return(true);
}
int find(int k)
{
if(data[k] < 0) return(k);
return(data[k] = find(data[k]));
}
int size(int k)
{
return(-data[find(k)]);
}
};
int main(){
int n,k,l;
cin >> n >> k >>l;
struct UnionFind g1(n),g2(n);
for(int i=0; i<k; i++){
int p,q;
cin >> p >> q;
g1.unite(p-1,q-1);
}
for(int i=0; i<l; i++){
int r,s;
cin >> r >> s;
g2.unite(r-1,s-1);
}
vector<pair<int,int>> s;
for(int i=0; i<n; i++){
s.push_back(make_pair(g1.find(i),g2.find(i)));
}
sort(s.begin(),s.end());
for(int i=0; i<n; i++){
cout << upper_bound(s.begin(),s.end(),make_pair(g1.find(i),g2.find(i)))
- lower_bond(s.begin(),s.end(),make_pair(g1.find(i),g2.find(i))) << ' ';
}
cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:55:16: error: 'lower_bond' was not declared in this scope
55 | - lower_bond(s.begin(),s.end(),make_pair(g1.find(i),g2.find(i))) << ' ';
| ^~~~~~~~~~
|
s900893798 | p03855 | C++ | import java.util.Scanner;
class PrintFlowerNumber {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.print("数字を入力してください:");
String numberString = stdIn.nextLine();
String print[][] = new String[10][5];
print[0][0] = "***** ";
print[0][1] = "* * ";
print[0][2] = "* * ";
print[0][3] = "* * ";
print[0][4] = "***** ";
print[1][0] = " * ";
print[1][1] = " * ";
print[1][2] = " * ";
print[1][3] = " * ";
print[1][4] = " * ";
print[2][0] = "***** ";
print[2][1] = " * ";
print[2][2] = "***** ";
print[2][3] = "* ";
print[2][4] = "***** ";
print[3][0] = "***** ";
print[3][1] = " * ";
print[3][2] = " **** ";
print[3][3] = " * ";
print[3][4] = "***** ";
print[4][0] = "* * ";
print[4][1] = "* * ";
print[4][2] = "***** ";
print[4][3] = " * ";
print[4][4] = " * ";
print[5][0] = "***** ";
print[5][1] = "* ";
print[5][2] = "***** ";
print[5][3] = " * ";
print[5][4] = "***** ";
print[6][0] = "***** ";
print[6][1] = "* ";
print[6][2] = "***** ";
print[6][3] = "* * ";
print[6][4] = "***** ";
print[7][0] = "***** ";
print[7][1] = " * ";
print[7][2] = " * ";
print[7][3] = " * ";
print[7][4] = " * ";
print[8][0] = "***** ";
print[8][1] = "* * ";
print[8][2] = "***** ";
print[8][3] = "* * ";
print[8][4] = "***** ";
print[9][0] = "***** ";
print[9][1] = "* * ";
print[9][2] = "***** ";
print[9][3] = " * ";
print[9][4] = "***** ";
int number;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < numberString.length(); j++) {
number = Character.getNumericValue(numberString.charAt(j));
System.out.print(print[number][i]);
}
System.out.println();
}
stdIn.close();
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:11: error: expected ':' before 'static'
4 | public static void main(String[] args) {
| ^~~~~~~
| :
a.cc:4:29: error: 'String' has not been declared
4 | public static void main(String[] args) {
| ^~~~~~
a.cc:4:38: error: expected ',' or '...' before 'args'
4 | public static void main(String[] args) {
| ^~~~
a.cc:81:2: error: expected ';' after class definition
81 | }
| ^
| ;
a.cc: In static member function 'static void PrintFlowerNumber::main(int*)':
a.cc:5:9: error: 'Scanner' was not declared in this scope
5 | Scanner stdIn = new Scanner(System.in);
| ^~~~~~~
a.cc:7:9: error: 'System' was not declared in this scope
7 | System.out.print("数字を入力してください:");
| ^~~~~~
a.cc:8:9: error: 'String' was not declared in this scope
8 | String numberString = stdIn.nextLine();
| ^~~~~~
a.cc:9:16: error: expected ';' before 'print'
9 | String print[][] = new String[10][5];
| ^~~~~
a.cc:11:9: error: 'print' was not declared in this scope; did you mean 'int'?
11 | print[0][0] = "***** ";
| ^~~~~
| int
a.cc:73:33: error: 'numberString' was not declared in this scope
73 | for (int j = 0; j < numberString.length(); j++) {
| ^~~~~~~~~~~~
a.cc:74:26: error: 'Character' was not declared in this scope
74 | number = Character.getNumericValue(numberString.charAt(j));
| ^~~~~~~~~
a.cc:79:9: error: 'stdIn' was not declared in this scope; did you mean 'std'?
79 | stdIn.close();
| ^~~~~
| std
|
s553990653 | p03855 | C++ | For train and road, execute
Union Find to get the index number
of both group. For each city, put
the pair of indices (r, t)into a map
to count the number of cities | a.cc:1:1: error: 'For' does not name a type
1 | For train and road, execute
| ^~~
|
s448825237 | p03855 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000;
const int MAX = 510000;
const int MOD = 1000000007;
const long long INF = 1LL << 60;
const ll MAXINDx = 3000;
const ll MAXINDy = 3000;
double dp[MAXINDx][MAXINDy] = {0};
vector<vector<int>> edges;
ll R, B, x, y;
bool check(ll mid)
{
if (mid > R || mid > B)
return false;
ll num = (R - mid) / (x - 1) + (B - mid) / (y - 1);
return (num >= mid);
}
bool comp(const pair<int, int> a, const pair<int, int> b)
{
return a.second < b.second;
}
struct UnionFind
{
vector<int> par;
//vector<int> rank;
UnionFind(int N) : par(N)
{
for (int i = 0; i < N; i++)
{
par[i] = i;
}
}
int root(int x)
{ // データxが属する木の根を再帰で得る:root(x) = {xの木の根}
if (par[x] == x)
return x;
return par[x] = root(par[x]);
}
void unite(int x, int y)
{ // xとyの木を併合
int rx = root(x); //xの根をrx
int ry = root(y); //yの根をry
if (rx == ry)
return; //xとyの根が同じ(=同じ木にある)時はそのまま
if (rank[rx] < rank[ry])
{
par[rx] = ry;
}
else
{
par[ry] = rx;
if (rank[rx] == rank[ry])
rank[rx]++;
}
}
bool same(int x, int y)
{ // 2つのデータx, yが属する木が同じならtrueを返す
int rx = root(x);
int ry = root(y);
return rx == ry;
}
};
int main()
{
int N, K, L;
cin >> N >> K >> L;
UnionFind dt(N);
UnionFind tt(N);
for (int i = 0; i < K; i++)
{
int x, y;
cin >> x >> y;
dt.unite(x - 1, y - 1);
}
for (int i = 0; i < L; i++)
{
int x, y;
cin >> x >> y;
tt.unite(x - 1, y - 1);
}
map<pair<int, int>, int> ans;
for (int i = 1; i <= N; i++)
{
int dr = dt.root(i - 1);
int tr = tt.root(i - 1);
if (ans.find(make_pair(dr, tr)) != ans.end())
ans[make_pair(dr, tr)]++;
else
ans[make_pair(dr, tr)] = 1;
}
for (int i = 1; i <= N; i++)
{
cout << ans[make_pair(dt.root(i - 1), tt.root(i - 1))] << " ";
}
cout << endl;
return 0;
}
/*Syakutori
cout << fixed << setprecision(10) << ans << endl;
while(cin >>b && b)){
ll t = 1;
long long int ansS = 1,ansT=0;
long long int sum = 0;
for(ll s = 1;s < 50000000;s++){
while(t < 50000000 && sum+Rsum[t] < b){
sum += Rsum[t];
t++;
}
if(b == sum+Rsum[t]){
if(ansT - ansS < t-s){
ansS = s;
ansT = t;
}
cout <<ansS<<" "<<ansT-ansS + 1<<endl;
break;
}
if(t == s)++t;
else sum -= Rsum[s];
}
}
//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;
ll gcd(ll a,ll b){
if(a%b == 0){
return b;
}else{
return gcd(b,a%b);
}
}
/*
int rec(int v){
int res = 0;
if(dp[v] > -1)return dp[v];
for(auto nv: edges[v]){
res = max(res, rec(nv) + 1);
}
return dp[v] = res;
}
*/
| a.cc: In member function 'void UnionFind::unite(int, int)':
a.cc:60:17: error: expected unqualified-id before '[' token
60 | if (rank[rx] < rank[ry])
| ^
a.cc:67:21: error: expected unqualified-id before '[' token
67 | if (rank[rx] == rank[ry])
| ^
a.cc:68:25: error: expected initializer before '++' token
68 | rank[rx]++;
| ^~
a.cc:68:25: error: expected ';' before '++' token
|
s528752770 | p03855 | C++ | #include <cstdio>
#include <iostream>
#include <tgmath.h>
#include <queue>
#include <cstring>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
const int MAX_N = 1000000;
struct UnionFind{
vector<int> par;
vector<int> rankTree;
void init(int n){
for(int i=0;i<n;i++){
par.push_back(i);
rankTree.push_back(i);
}
}
int find(int x){
if(par[x] == x){
return x;
}
return find(par[x]);
}
bool same(int x,int y){
return find(x) == find(y);
}
void unite(int x, int y){
if(same(x,y)){
return;
}
int rootx = find(x);
int rooty = find(y);
if(rankTree[rootx] < rankTree[rooty]){
par[rootx] = rooty;
return;
}
par[rooty] = rootx;
if(rankTree[rootx] == rankTree[rooty]){
rankTree[rootx] ++;
}
}
};
int N,K,L;
int p[MAX_N],q[MAX_N],r[MAX_N],s[MAX_N];
int ans[MAX_N];
int main(){
cin >>N >> K>> L;
for(int i=0;i<K;i++){
cin >> p[i] >> q[i];
u1.unite(p[i],q[i]);
}
for(int i=0; i<L;i++){
cin >> r[i] >> s[i];
u2.unite(r[i],s[i]);
}
UnionFind u1 = UnionFind();
u1.init(N+1);
UnionFind u2 = UnionFind();
u2.init(N+1);
for(int i=1; i<=N; i++){
for(int j=1; j<=N; j++){
if(u1.same(i,j) && u2.same(i,j)){
ans[i] ++;
}
}
cout << ans[i] << " ";
}
cout << endl;
} | a.cc: In function 'int main()':
a.cc:67:9: error: 'u1' was not declared in this scope; did you mean 'y1'?
67 | u1.unite(p[i],q[i]);
| ^~
| y1
a.cc:71:9: error: 'u2' was not declared in this scope
71 | u2.unite(r[i],s[i]);
| ^~
|
s511157918 | p03855 | C++ | #include <bits/stdc++.h>
using namespace std;
// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#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 trav(a, x) for (auto& a : x)
#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;
template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
namespace __input {
template<class T1, class T2> void re(pair<T1,T2>& p);
template<class T> void re(vector<T>& a);
template<class T, size_t SZ> void re(array<T,SZ>& a);
template<class T> void re(T& x) { cin >> x; }
void re(double& x) { string t; re(t); x = stod(t); }
template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
re(first); re(rest...);
}
template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;
namespace __output {
template<class T1, class T2> void pr(const pair<T1,T2>& x);
template<class T, size_t SZ> void pr(const array<T,SZ>& x);
template<class T> void pr(const vector<T>& x);
template<class T> void pr(const deque<T>& x);
template<class T> void pr(const set<T>& x);
template<class T1, class T2> void pr(const map<T1,T2>& x);
template<class T> void pr(const T& x) { cout << x; }
template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
pr(first); pr(rest...);
}
template<class T1, class T2> void pr(const pair<T1,T2>& x) {
pr("{",x.f,", ",x.s,"}");
}
template<class T, bool pretty = true> void prContain(const T& x) {
if (pretty) pr("{");
bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
if (pretty) pr("}");
}
template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
template<class T> void pr(const vector<T>& x) { prContain(x); }
template<class T> void pr(const deque<T>& x) { prContain(x); }
template<class T> void pr(const set<T>& x) { prContain(x); }
template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }
void ps() { pr("\n"); }
template<class Arg> void ps(const Arg& first) {
pr(first); ps();
}
template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
pr(first," "); ps(rest...);
}
}
using namespace __output;
#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush
namespace __algorithm {
template<typename T> void dedup(vector<T>& v) {
sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
}
template<typename T> size_t index(vector<T>& v, const T& x) {
auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
}
template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
}
template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
}
}
using namespace __algorithm;
struct monostate {
friend istream& operator>>(istream& is, const __attribute__((unused))monostate& ms) { return is; }
friend ostream& operator<<(ostream& os, const __attribute__((unused))monostate& ms) { return os; }
} ms;
template<typename W=monostate> struct wedge {
int u, v, i; W w;
wedge<W>(int _u=-1, int _v=-1, int _i=-1) : u(_u), v(_v), i(_i) {}
int operator[](int loc) const { return u ^ v ^ loc; }
friend void re(wedge& e) { re(e.u, e.v, e.w); --e.u, --e.v; }
friend void pr(const wedge& e) { pr(e.u, "<-", e.w, "->", e.v); }
};
namespace __io {
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
ios_base::sync_with_stdio(0); cin.tie(0);
cout << fixed << setprecision(15);
if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
}
}
using namespace __io;
// }}}
// union_find {{{
template<typename V = vi, typename E = monostate>
struct union_find {
struct node {
int par, rnk, size; V state;
node(int id = 0) : par(id), rnk(0), size(1), state({id}) {}
void merge(node& o, E& e) {
if (rnk == o.rnk) rnk++;
size += o.size;
state.insert(state.end(), all(o.state));
}
};
vector<node> uf;
union_find(int N = 0) : uf(N) {
for (int i = 0; i < N; i++)
uf[i] = node(i);
}
int rep(int i) {
if (i != uf[i].par)
uf[i].par = rep(uf[i].par);
return uf[i].par;
}
bool unio(int a, int b, E& e = ms) {
a = rep(a), b = rep(b);
if (a == b) return false;
if (uf[a].rnk < uf[b].rnk) swap(a, b);
uf[a].merge(uf[b], e);
uf[b].par = a;
return true;
}
node& operator[](int i) { return uf[rep(i)]; }
};
// }}}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
struct sp64_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = splitmix64(((uint64_t) new char | 1)
* chrono::steady_clock::now().time_since_epoch().count());
return splitmix64(x ^ FIXED_RANDOM);
}
};
template<class K> struct sp64_pair_hash {
size_t operator()(const pair<K, K>& x) const {
static_assert(sizeof(K) <= 4);
static sp64_hash sp64;
return sp64(((uint64_t) x.first << 32) ^ x.second);
}
};
template<class K, class V> using umap = gp_hash_table<K, V, sp64_hash>;
int main() {
setIO();
int N, K, L; re(N, K, L);
union_find<> roads(N);
F0R (k, K) {
int p, q; re(p, q); --p, --q;
roads.unio(p, q);
}
union_find<> rails(N);
F0R (l, L) {
int r, s; re(r, s); --r, --s;
rails.unio(r, s);
}
gp_hash_table<pii, int, sp64_pair_hash<int>> ct;
F0R (i, N) ct[{ roads.rep(i), rails.rep(i) }]++;
F0R (i, N) {
if (i) pr(" ");
pr(ct[{ roads.rep(i), rails.rep(i) }]);
}
ps();
// did you check N=1? did you mix up N,M?
return 0;
}
| a.cc:134:21: error: reference to 'monostate' is ambiguous
134 | template<typename W=monostate> struct wedge {
| ^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:1:
/usr/include/c++/14/variant:1237:10: note: candidates are: 'struct std::monostate'
1237 | struct monostate { };
| ^~~~~~~~~
a.cc:129:8: note: 'struct monostate'
129 | struct monostate {
| ^~~~~~~~~
a.cc:155:40: error: reference to 'monostate' is ambiguous
155 | template<typename V = vi, typename E = monostate>
| ^~~~~~~~~
/usr/include/c++/14/variant:1237:10: note: candidates are: 'struct std::monostate'
1237 | struct monostate { };
| ^~~~~~~~~
a.cc:129:8: note: 'struct monostate'
129 | struct monostate {
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:223:16: error: template argument 2 is invalid
223 | union_find<> roads(N);
| ^
a.cc:226:15: error: request for member 'unio' in 'roads', which is of non-class type 'int'
226 | roads.unio(p, q);
| ^~~~
a.cc:229:16: error: template argument 2 is invalid
229 | union_find<> rails(N);
| ^
a.cc:232:15: error: request for member 'unio' in 'rails', which is of non-class type 'int'
232 | rails.unio(r, s);
| ^~~~
a.cc:236:27: error: request for member 'rep' in 'roads', which is of non-class type 'int'
236 | F0R (i, N) ct[{ roads.rep(i), rails.rep(i) }]++;
| ^~~
a.cc:236:41: error: request for member 'rep' in 'rails', which is of non-class type 'int'
236 | F0R (i, N) ct[{ roads.rep(i), rails.rep(i) }]++;
| ^~~
a.cc:236:18: error: no match for 'operator[]' (operand types are '__gnu_pbds::gp_hash_table<std::pair<int, int>, int, sp64_pair_hash<int> >' and '<brace-enclosed initializer list>')
236 | F0R (i, N) ct[{ roads.rep(i), rails.rep(i) }]++;
| ^
In file included from /usr/include/c++/14/ext/pb_ds/detail/container_base_dispatch.hpp:72,
from /usr/include/c++/14/ext/pb_ds/assoc_container.hpp:48,
from a.cc:192:
/usr/include/c++/14/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:334:7: note: candidate: '__gnu_pbds::detail::gp_ht_map<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>::mapped_reference __gnu_pbds::detail::gp_ht_map<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>::operator[](key_const_reference) [with Key = std::pair<int, int>; Mapped = int; Hash_Fn = sp64_pair_hash<int>; Eq_Fn = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<char>; bool Store_Hash = false; Comb_Probe_Fn = __gnu_pbds::direct_mask_range_hashing<>; Probe_Fn = __gnu_pbds::linear_probe_fn<long unsigned int>; Resize_Policy = __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>; mapped_reference = int&; key_const_reference = const std::pair<int, int>&]'
334 | operator[](key_const_reference r_key)
| ^~~~~~~~
/usr/include/c++/14/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:334:38: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::gp_ht_map<std::pair<int, int>, int, sp64_pair_hash<int>, std::equal_to<std::pair<int, int> >, std::allocator<char>, false, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::linear_probe_fn<long unsigned int>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int> >::key_const_reference' {aka 'const std::pair<int, int>&'}
334 | operator[](key_const_reference r_key)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:240:23: error: request for member 'rep' in 'roads', which is of non-class type 'int'
240 | pr(ct[{ roads.rep(i), rails.rep(i) }]);
| ^~~
a.cc:240:37: error: request for member 'rep' in 'rails', which is of non-class type 'int'
240 | pr(ct[{ roads.rep(i), rails.rep(i) }]);
| ^~~
a.cc:240:14: error: no match for 'operator[]' (operand types are '__gnu_pbds::gp_hash_table<std::pair<int, int>, int, sp64_pair_hash<int> >' and '<brace-enclosed initializer list>')
240 | pr(ct[{ roads.rep(i), rails.rep(i) }]);
| ^
/usr/include/c++/14/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:334:7: note: candidate: '__gnu_pbds::detail::gp_ht_map<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>::mapped_reference __gnu_pbds::detail::gp_ht_map<Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>::operator[](key_const_reference) [with Key = std::pair<int, int>; Mapped = int; Hash_Fn = sp64_pair_hash<int>; Eq_Fn = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<char>; bool Store_Hash = false; Comb_Probe_Fn = __gnu_pbds::direct_mask_range_hashing<>; Probe_Fn = __gnu_pbds::linear_probe_fn<long unsigned int>; Resize_Policy = __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int>; mapped_reference = int&; key_const_reference = const std::pair<int, int>&]'
334 | operator[](key_const_reference r_key)
| ^~~~~~~~
/usr/include/c++/14/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:334:38: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to '__gnu_pbds::detail::gp_ht_map<std::pair<int, int>, int, sp64_pair_hash<int>, std::equal_to<std::pair<int, int> >, std::allocator<char>, false, __gnu_pbds::direct_mask_range_hashing<>, __gnu_pbds::linear_probe_fn<long unsigned int>, __gnu_pbds::hash_standard_resize_policy<__gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger<>, false, long unsigned int> >::key_const_reference' {aka 'const std::pair<int, int>&'}
334 | operator[](key_const_reference r_key)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
|
s093687293 | p03855 | C++ | #include<bits/stdc++.h>
using namespace std;
class unionfind {
vector<int> par, rank, size_;
public:
unionfind(int n) :par(n), rank(n), size_(n, 1) {
iota(all(par), 0);
}
int find(int x) {
if (par[x] == x)return x;
return par[x] = find(par[x]);
}
void unite(int x, int y) {
x = find(x), y = find(y);
if (x == y)return;
if (rank[x] < rank[y])swap(x, y);
par[y] = x;
size_[x] += size_[y];
if (rank[x] == rank[y])rank[x]++;
}
bool same(int x, int y) {
return find(x) == find(y);
}
int size(int x) {
return size_[find(x)];
}
};
signed main(){
int N,K,L;
cin >> N >> K >> L;
auto t = unionfind(N);
auto c = unionfind(N);
for(int i = 0; i < K; ++i){
int a,b; cin >> a >> b;
--a,--b;
t.unite(a,b);
}
for(int j = 0; j < L; ++j){
int a,b; cin >> a >> b;
--a,--b;
c.unite(a,b);
}
map<pair<int,int>,int>cnt;
for(int i = 0; i < N; ++i){
cnt[make_pair(t.find(i), c.find(i))] += 1;
}
for(int i = 0; i < N; ++i)
cout << cnt[make_pair(t.find(i),c.find(i))]<< endl;
}
| a.cc: In constructor 'unionfind::unionfind(int)':
a.cc:7:14: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
7 | iota(all(par), 0);
| ^~~
| std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
158 | all = 0777,
| ^~~
|
s440913771 | p03855 | C++ | // https://atcoder.jp/contests/abc049/tasks/arc065_b
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
struct UnionFind {
vector<int> par; // 親の番号
UnionFind(int size) : par(size, -1) {}
// xとyの木を併合
bool unite(int x, int y) {
x = root(x);
y = root(y);
if (x != y) {
if (par[y] < par[x])
swap(x, y);
par[x] += par[y];
par[y] = x;
return true;
} else {
return false;
}
}
// 2つのデータx, yが属する木が同じならtrueを返す
bool same(int x, int y) { return root(x) == root(y); }
// データxが属する木の根を再帰で得る:root(x) = {xの木の根}
int root(int x) { return par[x] < 0 ? x : par[x] = root(par[x]); }
// 頂点 v が属するグループと同じグループに属する頂点数を得る
int size(int x) { return -par[root(x)]; }
};
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, K, L;
cin >> N >> K >> L;
UnionFind uf1(N), uf2(N);
REP(i, K) {
int a, b;
cin >> a >> b;
uf1.unite(a - 1, b - 1);
}
REP(i, L) {
int a, b;
cin >> a >> b;
uf2.unite(a - 1, b - 1);
}
unordered_map<pii, int> mp;
REP(i, N) mp[{uf1.root(i), uf2.root(i)}]++;
REP(i, N)
cout << mp[{uf1.root(i), uf2.root(i)}] << (i == N - 1 ? "\n" : " ");
return 0;
}
| a.cc: In function 'int main()':
a.cc:51:29: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]'
51 | unordered_map<pii, int> mp;
| ^~
In file included from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:2:
/usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' is implicitly deleted because the default definition would be ill-formed:
148 | unordered_map() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h: At global scope:
/usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
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:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()'
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed:
1306 | struct _Hash_code_base
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted funct |
s209052021 | p03855 | C++ | #include<bits/stdc++.h>
using namespace std;
class UnionFind{
private:
vector<int> rank;
vector<int> par;
public:
UnionFind(int n){
rank.resize(n);
par.resize(n);
for(int i = 0; i < n; i++){
par[i] = i;
rank[i] = 0;
}
}
bool same(int a, int b){return root(a)==root(b);}
int root(int a){return (par[a]==a?a:root(par[a]));}
void unite(int a, int b){
int root_a = root(a), root_b = root(b);
if(root_a==root_b) return;
if(rank[root_a]>rank[root_b]){
par[root_b]=root_a;
}
else if(rank[root_a]==rank[root_b]){
par[root_b]=root_a;
rank[root_a]++;
}
else{
par[root_a] = root_b;
}
}
};
int main(){
int n, k, p;
cin>>n>>k>>p;
UnionFind u1(n+1);
for(int i =0; i<k; i++){
int a, b;
cin>>a>>b;
u1.unite(a, b);
}
UnionFind both(n+1);
for(int i =0; i<p; i++){
int a, b;
cin>>a>>b;
both.unite(a, b);
}
unordered_map<pair<int,int>, int> answer;
for(int i = 1; i <= n; i++){
answer[make_pair(u1.root(i), both.root(i))]++;
}
for(int i = 1; i <= n; i++){
cout<<answer[{u1.root(i), both.root(i)}]<<" ";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:52:39: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]'
52 | unordered_map<pair<int,int>, int> answer;
| ^~~~~~
In file included from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' is implicitly deleted because the default definition would be ill-formed:
148 | unordered_map() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h: At global scope:
/usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
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:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()'
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed:
1306 | struct _Hash_code_base
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: |
s755096877 | p03855 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
class UnionFind {
public:
vector<int> parent; //親ノード
vector<int> Siz; //集合の大きさ
// コンストラクタ
UnionFind(int n): parent(n), Siz(n, 1) {
rep(i, n) {
parent[i] = i;
}
}
// n要素で初期化
void init(int n) {
parent.resize(n);
Siz.assign(n, 1);
rep(i, n) {
parent[i] = i;
}
}
// xの属する集合の根を求める
int root(int x) {
if(parent[x] == x) {
return x;
}
else {
return parent[x] = root(parent[x]);
}
}
// xとyの属する集合を併合
void unite(int x, int y) {
x = root(x);
y = root(y);
if(x == y) {
return;
}
if(Siz[x] < Siz[y]) {
swap(x, y);
}
Siz[x] += Siz[y];
parent[y] = x;
}
// xとyが同じ集合に属するかどうか
bool same(int x, int y) {
return root(x) == root(y);
}
// xの属する集合の要素数を求める
int size(int x) {
return Siz[root(x)];
}
};
int main() {
int n, k, l;
cin >> n >> k >> l;
UnionFind Road(n), Rail(n);
rep(i, k) {
int p, q;
cin >> p >> q;
p--;
q--;
Road.unite(p, q);
}
rep(i, l) {
int r, s;
cin >> r >> s;
r--;
s--;
Rail.unite(r, s);
}
map<pair<int, int>> mp;
rep(i, n) {
mp[{Road.root(i), Rail.root(i)}]++;
}
rep(i, n) {
cout << mp[{Road.root(i), Rail.root(i)}] << " ";
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:97:22: error: wrong number of template arguments (1, should be at least 2)
97 | map<pair<int, int>> mp;
| ^~
In file included from /usr/include/c++/14/map:63,
from a.cc:10:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:100:11: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
100 | mp[{Road.root(i), Rail.root(i)}]++;
| ^
a.cc:104:19: error: invalid types 'int[<brace-enclosed initializer list>]' for array subscript
104 | cout << mp[{Road.root(i), Rail.root(i)}] << " ";
| ^
|
s604093448 | p03855 | C++ | #include <bits/stdc++.h>
using namespace std;
struct UnionFind {
vector<int> p;
UnionFind(int N) : p(N) {
for(int i=0; i<N; i++)
p[i] = i;
}
int root(int x) {
if (p[x] == x)
return x;
return p[x] = root(p[x]);
}
void unite(int x, int y) {
int rx = root(x);
int ry = root(y);
if (rx == ry)
return;
p[rx] = ry;
}
bool same(int x, int y) {
int rx = root(x);
int ry = root(y);
return rx == ry;
}
};
int main() {
int N,K,L,i,p,q;
cin >> N >> K >> L;
UnionFind r(N), t(N);
map<int,int> m;
for(i=0; i<K; i++) {
cin >> p >> q;
r.unite(p,q);
}
for(i=0; i<L; i++) {
cin >> p >> q;
if(r.same(p,q))
t.unite(p,q);
}
for(i=0; i<N; i++) {
if(m.count(t.root(i+1)))
m.at(t.root(i+1))++;
else
m[t.root(i+1)] = 1;
}
for(i=0; i<N; i++) {
if(m.count(root(i+1)))
cout << m.at(root(i+1));
else
cout << 1;
cout << endl;
}
} | a.cc: In function 'int main()':
a.cc:57:16: error: 'root' was not declared in this scope
57 | if(m.count(root(i+1)))
| ^~~~
|
s345758974 | p03855 | C++ | #include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mp make_pair
#define inf 1000000007
#define int long long
using namespace std;
ll par[114514];
ll rank[114514];
void init(int n){
for(int i=0;i<n;i++){
par[i] = i;
rank[i]=0;
}
}
ll find(ll x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par[x]);
}
}
void unite(ll x, ll y){
x = find(x);
y = find(y);
if(x==y)return;
if(rank[x]<rank[y]){
par[x]=y;
}else{
par[y]=x;
if(rank[x]==rank[y])rank[x]++;
}
}
signed main(){
int n,k,l;
cin>>n>>k>>l;
vector< pair<int,int> > p,q,gr;
multiset< pair<int,int> > sgr;
vector<int> cp,cq;
for(int i=0;i<k;i++){
int x,y;
cin>>x>>y;
p.pb(mp(x-1,y-1));
}
for(int i=0;i<l;i++){
int x,y;
cin>>x>>y;
q.pb(mp(x-1,y-1));
}
init(n);
for(int i=0;i<p.size();i++){
unite(p[i].first,p[i].second);
}
for(int i=0;i<n;i++){
cp.pb(find(i));
}
init(n);
for(int i=0;i<q.size();i++){
unite(q[i].first,q[i].second);
}
for(int i=0;i<n;i++){
cq.pb(find(i));
}
for(int i=0;i<n;i++){
gr.pb(mp(cp[i],cq[i]));
sgr.insert(mp(cp[i],cq[i]));
}
for(int i=0;i<n;i++){
cout<<sgr.count(gr[i])<<" ";
}
cout<<endl;
return 0;
} | a.cc: In function 'void init(long long int)':
a.cc:13:17: error: reference to 'rank' is ambiguous
13 | rank[i]=0;
| ^~~~
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:9:4: note: 'long long int rank [114514]'
9 | ll rank[114514];
| ^~~~
a.cc: In function 'void unite(long long int, long long int)':
a.cc:27:12: error: reference to 'rank' is ambiguous
27 | if(rank[x]<rank[y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:4: note: 'long long int rank [114514]'
9 | ll rank[114514];
| ^~~~
a.cc:27:20: error: reference to 'rank' is ambiguous
27 | if(rank[x]<rank[y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:4: note: 'long long int rank [114514]'
9 | ll rank[114514];
| ^~~~
a.cc:31:20: error: reference to 'rank' is ambiguous
31 | if(rank[x]==rank[y])rank[x]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:4: note: 'long long int rank [114514]'
9 | ll rank[114514];
| ^~~~
a.cc:31:29: error: reference to 'rank' is ambiguous
31 | if(rank[x]==rank[y])rank[x]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:4: note: 'long long int rank [114514]'
9 | ll rank[114514];
| ^~~~
a.cc:31:37: error: reference to 'rank' is ambiguous
31 | if(rank[x]==rank[y])rank[x]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:9:4: note: 'long long int rank [114514]'
9 | ll rank[114514];
| ^~~~
|
s941621647 | p03855 | C++ | // D - 連結 / Connectivity
#include <bits/stdc++.h>
#include "../../template-proj/myMente.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define MAX 200000
map<int,vi> road, rail;
vector<bool> visit(MAX);
vi road_group(MAX);
vi rail_group(MAX);
void road_dfs(int g, int p){
if(visit[p]) return;
visit[p] = true;
road_group[p] = g;
for(auto c:road[p]){
road_dfs(g,c);
}
}
void rail_dfs(int g, int p){
if(visit[p]) return;
visit[p] = true;
rail_group[p] = g;
for(auto c:rail[p]){
rail_dfs(g,c);
}
}
int main(){
int N,K,L; cin>>N>>K>>L;
rp(i,K){
int p,q;cin>>p>>q;
road[p-1].push_back(q-1);
}
rp(i,L){
int r,s;cin>>r>>s;
rail[r-1].push_back(s-1);
}
// for(auto v:road){
// ot(v.first);ot(")");
// for(auto e:v.second){
// ot(e);ot(",");
// }
// ot("\n");
// }ote("---");
// for(auto v:rail){
// ot(v.first);ot(")");
// for(auto e:v.second){
// ot(e);ot(",");
// }
// ot("\n");
// }ote("---");
rp(i,N) visit[i] = false;
rp(i,N) road_dfs(i,i);
rp(i,N) visit[i] = false;
rp(i,N) rail_dfs(i,i);
// for(int i=0;i<N;++i) cout<<road_group[i]<<",";ote("");//
// for(int i=0;i<N;++i) cout<<rail_group[i]<<",";ote("");//
map<pair<int,int>,int> ans;//<<road,rail>,count>
rp(i,N){
ans[make_pair(road_group[i], rail_group[i])]++;
}
// for(auto p:ans){cout<<p.first.first<<","<<p.first.second<<","<<p.second<<"\n";}
rp(i,N){
cout<< ans[make_pair(road_group[i], rail_group[i])];
cout<<(i+1<N?" ":"\n");
}
}
| a.cc:3:10: fatal error: ../../template-proj/myMente.h: No such file or directory
3 | #include "../../template-proj/myMente.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s871255923 | p03855 | C++ | #include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#define MOD 1000000007
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
int par[200000];//親
int urank[200000];//深さ
//n要素で初期化
void init(int n){
for(int i=0;i<n;i++){
par[i]=i;
urank[i]=0;
}
return;
}
//木の根を求める
int find(int x){
if(par[x]==x){
return x;
}else{
return par[x]=find(par[x]);
}
}
//xとyの属する集合を併合
void unite(int x,int y){
x=find(x);
y=find(y);
if(x==y)return;
if(urank[x]<urank[y]){
par[x]=y;
}else{
par[y]=x;
if(urank[x]==urank[y])urank[x]++;
}
return;
}
//xとyが同じ集合に属するか否か
bool same(int x,int y){
return find(x)==find(y);
}
int par2[200000];//親
int urank[200000];//深さ
//n要素で初期化
void init2(int n){
for(int i=0;i<n;i++){
par2[i]=i;
urank2[i]=0;
}
return;
}
//木の根を求める
int find2(int x){
if(par2[x]==x){
return x;
}else{
return par2[x]=find2(par2[x]);
}
}
//xとyの属する集合を併合
void unite2(int x,int y){
x=find2(x);
y=find2(y);
if(x==y)return;
if(urank2[x]<urank2[y]){
par2[x]=y;
}else{
par2[y]=x;
if(urank2[x]==urank2[y])urank2[x]++;
}
return;
}
//xとyが同じ集合に属するか否か
bool same2(int x,int y){
return find2(x)==find2(y);
}
signed main(){
int n;
cin>>n;
init(n);
init2(n);
int k,l;
cin>>k>>l;
for(int i=0;i<k;i++){
int p,q;
cin>>p>>q;
unite(p-1,q-1);
}
for(int i=0;i<l;i++){
int p,q;
cin>>p>>q;
unite2(p-1,q-1);
}
for(int i=0;i<n-1;i++){
int cnt=0;
for(int j=0;j<n;j++){
if(same(i,j)&&same2(i,j))cnt++;
}
cout<<cnt<<" ";
}
int cnt=0;
for(int i=0;i<n;i++){
if(same(n-1,i)&&same2(n-1,i))cnt++;
}
cout<<cnt<<endl;
return 0;
}
| a.cc:62:5: error: redefinition of 'long long int urank [200000]'
62 | int urank[200000];//深さ
| ^~~~~
a.cc:22:5: note: 'long long int urank [200000]' previously declared here
22 | int urank[200000];//深さ
| ^~~~~
a.cc: In function 'void init2(long long int)':
a.cc:67:9: error: 'urank2' was not declared in this scope; did you mean 'urank'?
67 | urank2[i]=0;
| ^~~~~~
| urank
a.cc: In function 'void unite2(long long int, long long int)':
a.cc:87:8: error: 'urank2' was not declared in this scope; did you mean 'urank'?
87 | if(urank2[x]<urank2[y]){
| ^~~~~~
| urank
|
s058085010 | p03855 | Java | import sun.font.TrueTypeFont;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static List<HashSet<Integer>> group ;
static List<HashSet<Integer>> group2 ;
static int[] roads ;
static int[] rialways ;
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Scanner in = new Scanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
int n = in.nextInt();
int k = in.nextInt();
int l = in.nextInt();
roads = new int[n+1];
rialways = new int[n+1];
group = new ArrayList<>(n+1);
group2 = new ArrayList<>(n+1);
HashMap<String,Integer> mem = new HashMap<>();
for(int i=1;i<=n;i++){
roads[i]=i;
rialways[i]=i;
}
for(int i =0;i<=n;i++){
group.add(new HashSet<>());
group2.add(new HashSet<>());
}
for(int i=0;i<k;i++){
int a = in.nextInt();
int b = in.nextInt();
int boss1 = find_parent(roads,roads[a],a);
int boss2 = find_parent(roads,roads[b],b);
int mn = Math.min(boss1,boss2);
roads[boss1]=mn;
roads[boss2]=mn;
}
for(int i=0;i<l;i++){
int a = in.nextInt();
int b = in.nextInt();
int boss1 = find_parent(rialways,rialways[a],a);
int boss2 = find_parent(rialways,rialways[b],b);
for(int i=1;i<=n;i++){
int boss = find_parent(roads,roads[i],i);
group.get(boss).add(i);
roads[i]=boss;
boss = find_parent(rialways,rialways[i],i);
group2.get(boss).add(i);
rialways[i]=boss;
}
for(int i=1;i<=n;i++){
int j = roads[i];
int jj = rialways[i];
HashSet<Integer> intersect = new HashSet<>(group.get(j));
intersect.retainAll(group2.get(jj));
System.out.print(intersect.size()+" ");
}
}
static int find_parent(int[] arr,int p,int i){
if(p==i){
return i;
}
else {
return find_parent(arr,arr[p],p);
}
}
}
| Main.java:65: error: illegal start of expression
static int find_parent(int[] arr,int p,int i){
^
1 error
|
s652653776 | p03855 | Java | import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Connectivity {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Scanner in = new Scanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
int n = in.nextInt();
int k = in.nextInt();
int l = in.nextInt();
int[] roads = new int[n+1];
int[] rialways = new int[n+1];
List<HashSet<Integer>> group = new ArrayList<>(n+1);
List<HashSet<Integer>> group2 = new ArrayList<>(n+1);
HashMap<String,Integer> mem = new HashMap<>();
for(int i =0;i<=n;i++){
group.add(new HashSet<>());
group2.add(new HashSet<>());
}
for(int i=0;i<k;i++){
int a = in.nextInt();
int b = in.nextInt();
if (a<b){
if (roads[a]==0)
roads[b]=a;
else
roads[b]=roads[a];
}
else{
if (roads[b]==0)
roads[a]=b;
else
roads[b]=roads[a];
}
}
for(int i=0;i<l;i++){
int a = in.nextInt();
int b = in.nextInt();
if (a<b){
if (rialways[a]==0)
rialways[b]=a;
else
rialways[b]=roads[a];
}
else{
if (rialways[b]==0)
rialways[a]=b;
else
rialways[b]=roads[a];
}
}
for(int i=1;i<=n;i++){
if (roads[i]==0)
group.get(i).add(i);
else{
int boss = roads[i];
if (roads[boss] ==0)
group.get(boss).add(i);
else{
group.get(roads[boss]).add(i);
roads[i] = roads[boss];
}
}
}
for(int i=1;i<=n;i++){
if (rialways[i]==0)
group2.get(i).add(i);
else{
int boss = rialways[i];
if (rialways[boss] ==0)
group2.get(boss).add(i);
else{
group2.get(rialways[boss]).add(i);
rialways[i] = rialways[boss];
}
}
}
for(int i=1;i<=n;i++){
int j,jj;
if (roads[i]==0)
j = i;
else
j= roads[i];
if (rialways[i]==0)
jj = i;
else
jj= rialways[i];
HashSet<Integer> intersect = new HashSet<>(group.get(j));
intersect.retainAll(group2.get(jj));
System.out.print(intersect.size()+" ");
}
}
}
| Main.java:5: error: class Connectivity is public, should be declared in a file named Connectivity.java
public class Connectivity {
^
1 error
|
s610960737 | p03855 | C++ | #include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
struct UnionFind
{
int n;
vector<int> parent;
vector<int> rank;
UnionFind(int _n) :n(_n)
{
parent.assign(n, -1);
rank.assign(n, 1);
}
int find(int i)
{
if (parent[i] == -1)
return i;
else
return parent[i] = find(parent[i]);
}
void unite(int i, int j)
{
i = find(i);
j = find(j);
if (i == j) return;
if (rank[i] == rank[j])
{
parent[j] = i;
++rank[i];
}
else
{
if (rank[i] < rank[j]) swap(i, j);
parent[j] = i;
}
}
bool is_same(int i, int j)
{
return find(i) == find(j);
}
};
int main()
{
int n, k, l;
cin >> n >> k >> l;
UnionFind uf_road(n);
rep(i, 0, k)
{
int p, q;
cin >> p >> q;
--p, --q;
uf_road.unite(p, q);
}
UnionFind uf_express(n);
rep(i, 0, l)
{
int p, q;
cin >> p >> q;
--p, --q;
uf_express.unite(p, q);
}
map<pii, int> type_cnt;
rep(i, 0, n)
{
int p1, p2;
p1 = uf_road.find(i);
p2 = uf_express.find(i);
++type_cnt[make_pair(p1, p2)];
}
rep(i, 0, n)
{
int p1, p2;
p1 = uf_road.find(i);
p2 = uf_express.fsind(i);
printf("%d ", type_cnt[make_pair(p1, p2)]);
}
cout << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:89:25: error: 'struct UnionFind' has no member named 'fsind'; did you mean 'find'?
89 | p2 = uf_express.fsind(i);
| ^~~~~
| find
|
s217390680 | p03855 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);
class UnionFind {
public:
vector<int> Parent;
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
int size(int A) {
return -Parent[root(A)];
}
bool connect(int A, int B) {
A = root(A);
B = root(B);
if (A == B) return false;
if (size(A) < size(B)) swap(A, B);
Parent[A] += Parent[B];
Parent[B] = A;
return true;
}
};
int main() {
int N, K, L; cin >> N >> K >>L;
UnionFind road(N);
UnionFind rail(N);
rep(i, K) {
int p, q; cin >> p >> q;
road.connect(p-1, q-1);
}
rep(i, L) {
int p, q; cin >> p >> q;
rail.connect(p-1, q-1);
}
map<pair<int, int>, int> cnt;
rep(i, N) {
pair<int, int> p = make_pair(road.root(i), rail.root(i));
auto itr = cnt.find(p);
if (itr != cnt.end()) {
cnt[p]++;
} else {
cnt[p] = 1;
}
}
rep(i, N) {
pair<int, int> p = make_pair(road.root(i), rail.root(i));
cout << cnt[p] << " ";
}
return 0;
| a.cc: In function 'int main()':
a.cc:75:12: error: expected '}' at end of input
75 | return 0;
| ^
a.cc:41:12: note: to match this '{'
41 | int main() {
| ^
|
s367764535 | p03855 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;
class UnionFind {
public:
vector<int>par, rank
//vector<int>node;
UnionFind(int n) :par(n), rank(n, 0)/*,node(n,1)*/ {
for (int i = 0;i < n;i++)par[i] = i;
}
/*void init(int n) {
for (int i = 0;i < n;i++) {
par[i] = i;
rank[i] = 0;
node[i] = 1;
}
}*/
int find(int x) {
return par[x] == x ? x : par[x] = find(par[x]);
}
bool same(int x, int y) {
return find(x) == find(y);
}
void unite_tree(int x, int y) {
x = find(x);
y = find(y);
if (x == y)return;
if (rank[x] < rank[y]) {
par[x] = y;
}
else {
par[y] = x;
if (rank[x] == rank[y])rank[x]++;
}
}
int root_size(int x){
return rank[find(x)];
}
/*int size(int x) {
return node[find(x)];
}
void unite_node(int x, int y) {
x = find(x);
y = find(y);
if (x == y)return;
if (size(x) < size(y))swap(x, y);
node[x] += node[y];
par[y] = par[x];
}*/
};
int main(void){
int n,k,l;
int p,q;
map<P,int>num;
cin>>n>>k>>l;
UnionFind uf(n),uf1(n);
for(int i=0;i<k;i++){
cin>>p>>q;
uf.unite_tree(p,q);
}
for(int i=0;i<l;i++){
cin>>p>>q;
uf1.unite_tree(p,q);
}
for(int i=1;i<=n;i++){
p=uf.find(i);
q=uf1.find(i);
num[P(p,q)]++;
}
for(int i=1;i<=n;i++){
if(i==n){
p=uf.find(i);
q=uf1.find(i);
cout<<num[P(p,q)]<<endl;
}
else{
p=uf.find(i);
q=uf1.find(i);
cout<<num[P(p,q)]<<" ";
}
}
return 0;
} | a.cc:18:25: error: expected ';' at end of member declaration
18 | vector<int>par, rank
| ^~~~
| ;
|
s341079238 | p03855 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;
class UnionFind {
public:
vector<int>par, rank
//vector<int>node;
UnionFind(int n) :par(n), rank(n, 0)/*,node(n,1)*/ {
for (int i = 0;i < n;i++)par[i] = i;
}
void init(int n) {
for (int i = 0;i < n;i++) {
par[i] = i;
rank[i] = 0;
node[i] = 1;
}
}
int find(int x) {
return par[x] == x ? x : par[x] = find(par[x]);
}
bool same(int x, int y) {
return find(x) == find(y);
}
void unite_tree(int x, int y) {
x = find(x);
y = find(y);
if (x == y)return;
if (rank[x] < rank[y]) {
par[x] = y;
}
else {
par[y] = x;
if (rank[x] == rank[y])rank[x]++;
}
}
int root_size(int x){
return rank[find(x)];
}
int size(int x) {
return node[find(x)];
}
/*void unite_node(int x, int y) {
x = find(x);
y = find(y);
if (x == y)return;
if (size(x) < size(y))swap(x, y);
node[x] += node[y];
par[y] = par[x];
}*/
};
int main(void){
int n,k,l;
int p,q;
map<P,int>num;
cin>>n>>k>>l;
UnionFind uf(n),uf1(n);
for(int i=0;i<k;i++){
cin>>p>>q;
uf.unite_tree(p,q);
}
for(int i=0;i<l;i++){
cin>>p>>q;
uf1.unite_tree(p,q);
}
for(int i=1;i<=n;i++){
p=uf.find(i);
q=uf1.find(i);
num[P(p,q)]++;
}
for(int i=1;i<=n;i++){
if(i==n){
p=uf.find(i);
q=uf1.find(i);
cout<<num[P(p,q)]<<endl;
}
else{
p=uf.find(i);
q=uf1.find(i);
cout<<num[P(p,q)]<<" ";
}
}
return 0;
} | a.cc:18:25: error: expected ';' at end of member declaration
18 | vector<int>par, rank
| ^~~~
| ;
a.cc: In member function 'void UnionFind::init(int)':
a.cc:27:25: error: 'node' was not declared in this scope
27 | node[i] = 1;
| ^~~~
a.cc: In member function 'int UnionFind::size(int)':
a.cc:56:24: error: 'node' was not declared in this scope
56 | return node[find(x)];
| ^~~~
|
s966259385 | p03855 | C++ | // #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
// #include <deque>
// #include <queue>
// #include <array>
// #include <ctime>
// #include <list>
#include <map>
#include <set>
// #include <cassert>
// #include <complex>
// #include <sstream>
// #include <forward_list>
// #include <unordered_set>
// #include <unordered_map>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define scani(n) scanf("%d",&n);
#define EPS 1e-9
#define FOR(i,n) for(int i=0; i<n; i++)
#define X first
#define Y second
#define arrinput for(int i=0; i<n; i++) cin>>arr[i];
#define arrsum for(int i=0; i<n; i++) sum+=arr[i];
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,n) for(int i=n-1; i>=0; i--)
#define sz(a) (int)(a.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
const int MOD = 1e9+7;
const int n_ = 1e5+1000;
const long double PI = acos(-1.0);
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
bool vowel(char ch) {
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true;
else return false;
}
// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
class UnionFind { // OOP style
private:
vi p, rank, setSize; // remember: vi is vector<int>
int numSets;
public:
UnionFind(int N) {
setSize.assign(N, 1); numSets = N; rank.assign(N, 0);
p.assign(N, 0); for (int i = 0; i < N; i++) p[i] = i; }
int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
void unionSet(int i, int j) {
if (!isSameSet(i, j)) { numSets--;
int x = findSet(i), y = findSet(j);
// rank is used to keep the tree short
if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
else { p[x] = y; setSize[y] += setSize[x];
if (rank[x] == rank[y]) rank[y]++; } } }
int numDisjointSets() { return numSets; }
int sizeOfSet(int i) { return setSize[findSet(i)]; }
};
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n, k, l, x, y;
cin>>n>>k>>l;
UnionFind uf1(n);
UnionFind uf2(n);
for0(i,k) {
cin>>x>>y;
x--; y--;
uf1.unionSet(x, y);
}
for0(i,l) {
cin>>x>>y;
x--; y--;
uf2.unionSet(x, y);
}
map<pair<pii, int>> ans;
for0(i,n) {
ans[mp(uf1.findSet(i), uf2.findSet(i))]++;
}
for0(i,n) {
cout<<ans[mp(uf1.findSet(i), uf2.findSet(i))]<<" ";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:105:22: error: wrong number of template arguments (1, should be at least 2)
105 | map<pair<pii, int>> ans;
| ^~
In file included from /usr/include/c++/14/map:63,
from a.cc:15:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:107:12: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<long long int, long long int>')
107 | ans[mp(uf1.findSet(i), uf2.findSet(i))]++;
| ^
a.cc:110:18: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<long long int, long long int>')
110 | cout<<ans[mp(uf1.findSet(i), uf2.findSet(i))]<<" ";
| ^
|
s274172739 | p03855 | C++ | #include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
template<class T>
inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>
inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
struct UnionFind {
vector<int> rank, parent;
UnionFind() {}
UnionFind(int size) {
rank.resize(size, 0);
parent.resize(size, 0);
for (int i = 0; i < size; ++i) {
makeSet(i);
}
}
void makeSet(int x) {
parent[x] = x;
rank[x] = 0;
}
void link(int x, int y) {
if (rank[x] < rank[y]) {
parent[x] = y;
} else {
parent[y] = x;
if (rank[x] == rank[y]) rank[x]++;
}
}
bool same(int x, int y) {
return find(x) == find(y);
}
void unite(int x, int y) {
link(find(x), find(y));
}
int find(int x) {
if (parent[x] != x) {
parent[x] = find(parent[x]);
}
return parent[x];
}
};
int main() {
int n, k, l, p, q;
cin >> n >> k >> l;
UnionFind ro(n+1);
UnionFind ra(n+1);
rep(i, k){
cin >> p >> q;
ro.unite(p, q);
}
rep(i, l){
cin >> p >> q;
ra.unite(p, q);
}
vector<pair<int,int> > com(n);
map<pair<int,int> ,int> s;1
reps(i, n){
com[i].first = ro.find(i);
com[i].second = ra.find(i);
s[com[i]]++;
}
for(int i = 0; i < n; i++){
cout << s[com[i]] << " ";
}printf("\n");
}
| a.cc: In function 'int main()':
a.cc:97:32: error: expected ';' before 'for'
97 | map<pair<int,int> ,int> s;1
| ^
| ;
a.cc:98:10: error: 'i' was not declared in this scope
98 | reps(i, n){
| ^
a.cc:20:32: note: in definition of macro 'reps'
20 | #define reps(i, x) for(int i=1;i<=(int)(x);i++)
| ^
|
s452933952 | p03855 | C++ | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// 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
using namespace std;
typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll Mypow(ll x, ll k){
ll res = 1;
while(k > 0){
if(k % 2) res *= x;
x *= x;
k /= 2;
}
return res;
}
ll gcd(ll a, ll b){//計算量はO(log(max(a,b))
if(b == 0) return a;
return gcd(b, a % b);
}
ll INFL = 1LL << 60;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};
struct UnionFind{
const int SIZE = 200010;
vector<int> par, Rank;
void init_UF(int N_){
int N = N_;
par.resize(N), Rank.resize(N);
rep(i, N){
par[i] = i;
Rank[i] = 1;
}
}
inline int find(int x){
if(par[x] == x) return x;
else{
return par[x] = find(par[x]);
}
}
bool same(int x, int y){
return find(x) == find(y);
}
inline ivoid unite(int x, int y){
int rx = find(x), ry = find(y);
if(rx != ry){
if(Rank[rx] >= Rank[ry]){
par[ry] = rx;
if(Rank[rx] == Rank[ry]) Rank[rx]++;
}else{
par[rx] = ry;
}
}
}
};
int N, K, L;
vector<int> p, q, r, s;
UnionFind U, V;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> K >> L;
p.resize(K), q.resize(K);
r.resize(L), s.resize(L);
rep(i, K){
cin >> p[i] >> q[i];
p[i]--, q[i]--;
}
rep(i, L){
cin >> r[i] >> s[i];
r[i]--, s[i]--;
}
U.init_UF(N), V.init_UF(N);
rep(i, K) U.unite(p[i], q[i]);
rep(i, L) V.unite(r[i], s[i]);
multiset<pair<int, int>> cnt;
rep(i, N){
cnt.insert({U.find(i), V.find(i)});
}
rep(i, N) cout << cnt.count({U.find(i), V.find(i)}) << endl;
}
| a.cc:145:10: error: 'ivoid' does not name a type; did you mean 'void'?
145 | inline ivoid unite(int x, int y){
| ^~~~~
| void
a.cc: In function 'int main()':
a.cc:177:15: error: 'struct UnionFind' has no member named 'unite'
177 | rep(i, K) U.unite(p[i], q[i]);
| ^~~~~
a.cc:178:15: error: 'struct UnionFind' has no member named 'unite'
178 | rep(i, L) V.unite(r[i], s[i]);
| ^~~~~
|
s891490571 | p03855 | C++ | //file_name:ABC49_D.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
// int scan
/*
int x;
scanf("%d",&x);
int y;
scanf("%d",&y);
int z;
scanf("%d",&z);
// matrix scan
/*
ll a[n] = {};
rep(i,n){
scanf("%lld",&a[i]);
}
*/
// string scan
/*
string s;
cin >> s;
*/
// n要素で初期化
void init(int par[], int rank[], int n){
for(int i=0;i<n;i++){
par[i] = i;
rank[i] = 0;
}
}
// 木の根を求める
int find(int par[], int x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par,par[x]);
}
}
// xとyの属する集合を併合
void unite(int par[], int rank[], int x, int y){
x = find(par,x);
y = find(par,y);
if(x == y) return;
if(rank[x] < rank[y]){
par[x] = y;
}else{
par[y] = x;
if(rank[x] == rank[y]) rank[x]++;
}
}
// xとyが同じ集合に属するか否か
bool same(int par[], int x, int y){
return find(par,x) == find(par,y);
}
int main() {
int n,k,l;
cin >> n >> k >> l;
int par1[n];
int rank1[n];
init(par1,rank1,n);
rep(i,k){
int a,b;
cin >> a >> b;
unite(par1,rank1,a-1,b-1);
}
int par2[n];
int rank2[n];
init(par2,rank2,n);
rep(i,l){
int a,b;
cin >> a >> b;
unite(par2,rank2,a-1,b-1);
}
vector<int> v;
rep(i,n){
v[find(par1,i)*n+find(par2,i)].push_back(i);
}
rep(i,n){
cout << v[find(par1,i)*n+find(par2,i)].size() << ' ';
}
cout << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:139:40: error: request for member 'push_back' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)((find(((int*)(& par1)), i) * n) + find(((int*)(& par2)), i))))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
139 | v[find(par1,i)*n+find(par2,i)].push_back(i);
| ^~~~~~~~~
a.cc:142:48: error: request for member 'size' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)((find(((int*)(& par1)), i) * n) + find(((int*)(& par2)), i))))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
142 | cout << v[find(par1,i)*n+find(par2,i)].size() << ' ';
| ^~~~
|
s535315778 | p03855 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
// https://tmasaaa.github.io/kaito_procon/procon/201810041749.html
class UnionFind {
private:
vector<int> parent;
vector<int> height;
vector<int> m_size;
public:
UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
for(int i = 0; i < size_; ++i)
parent[i] = i;
}
void init(int size_) {
parent.resize(size_);
height.resize(size_, 0);
m_size.resize(size_, 0);
for(int i = 0; i < size_; ++i)
parent[i] = i;
}
int find(int x) {
if(parent[x] == x)
return x;
return parent[x] = find(parent[x]);
}
void unite(int x, int y) {
x = find(x);
y = find(y);
if(x == y)
return;
int t = size(x) + size(y);
m_size[x] = m_size[y] = t;
if(height[x] < height[y])
parent[x] = y;
else
parent[y] = x;
if(height[x] == height[y])
++height[x];
}
bool same(int x, int y) { return find(x) == find(y); }
int size(int x) {
if(parent[x] == x)
return m_size[x];
return size(parent[x] = find(parent[x]));
}
};
int main() {
long long N, K, L;
cin >> N >> K >> L;
vector<long long> p(K), q(K);
REP(i, K) cin >> p[i] >> q[i];
vector<long long> s(L), r(L);
REP(i, L) cin >> r[i] >> s[i];
UnionFind road(N);
REP(i, K) { road.unite(p[i] - 1, q[i] - 1); }
UnionFind rail(N);
REP(i, L) { rail.unite(r[i] - 1, s[i] - 1); }
vector<int> a(N);
vector<int> b(N);
REP(i, N) {
a[i] = road.find(i);
b[i] = rail.find(i);
mp[make_pair(a[i], b[i])]++;
}
REP(i, N){cout << mp[make_pair(a[i], b[i])] << " "} cout << endl;
} | a.cc: In function 'int main()':
a.cc:88:9: error: 'mp' was not declared in this scope; did you mean 'p'?
88 | mp[make_pair(a[i], b[i])]++;
| ^~
| p
a.cc:90:23: error: 'mp' was not declared in this scope; did you mean 'p'?
90 | REP(i, N){cout << mp[make_pair(a[i], b[i])] << " "} cout << endl;
| ^~
| p
|
s025924881 | p03855 | C++ | #include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
class UnionFind {
public:
//親の番号を格納する.親だった場合は-(その集合のサイズ)
vector<int> Parent;
//作るときはParentの値をすべて-1にする
//こうするとすべてバラバラになる
UnionFind(int N) { Parent = vector<int>(N, -1); }
// Aがどのグループに所属しているか
int root(int A) {
if(Parent[A] < 0)
return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)]; //親を取って行きたい
}
// AとBをくっつける
bool connect(int A, int B) {
// AとBを直接つなぐのではなく,root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if(A == B) {
//すでにくっついているからくっつけない
return false;
}
//大きい方(A)に小さい方(B)をくっつけたい
//大小が逆だったらひっくり返しちゃう
if(size(A) < size(B))
swap(A, B);
// Aのサイズを更新する
Parent[A] += Parent[B];
// Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main() {
long long N, K, L;
cin >> N >> K >> L;
vector<long long> p(K), q(K);
vector<long long> s(L), r(L);
REP(i, K) cin >> p[i] >> q[i];
set<pair<long long, long long>> road;
REP(i, K) {
if(p[i] < q[i])
road.insert(make_pair(p[i], q[i]));
else
road.insert(make_pair(q[i], p[i]));
}
REP(i, L) cin >> r[i] >> s[i];
set<pair<long long, long long>> rail;
REP(i, L) {
if(r[i] < s[i]) {
rail.insert(make_pair(r[i], s[i]));
} else {
rail.insert(make_pair(s[i], r[i]));
}
}
UnionFind city(N);
for(auto ite = road.begin(); ite < road.end(); ite++) {
if(rail.find(*ite) != rail.end()) {
city.connect(*ite.first, *ite.second);
}
}
REP(i, N) {
if(city.Parent[i] < -1) {
cout << -city.Parent[i];
}
}
cout << endl;
} | a.cc: In function 'int main()':
a.cc:91:38: error: no match for 'operator<' (operand types are 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' and 'std::set<std::pair<long long int, long long int> >::iterator' {aka 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::const_iterator'})
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ~~~ ^ ~~~~~~~~~~
| | |
| | _Rb_tree_const_iterator<[...]>
| _Rb_tree_const_iterator<[...]>
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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::set<std::pair<long long int, long long int> >::iterator' {aka 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::const_iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::set<std::pair<long long int, long long int> >::iterator' {aka 'std::_Rb_tree<std::pair<long long int, long long int>, std::pair<long long int, long long int>, std::_Identity<std::pair<long long int, long long int> >, std::less<std::pair<long long int, long long int> >, std::allocator<std::pair<long long int, long long int> > >::const_iterator'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::__cxx11::sub_match<_BiIter>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::pair<_T1, _T2>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::reverse_iterator<_Iterator>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::move_iterator<_IteratorL>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
/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:91:49: note: 'std::_Rb_tree_const_iterator<std::pair<long long int, long long int> >' is not derived from 'const std::move_iterator<_IteratorL>'
91 | for(auto ite = road.begin(); ite < road.end(); ite++) {
| ^
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.