submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s879954894
p03798
C++
#include<bits/stdc++.h> using namespace std; int main() { int N; string str; cin >> N >> str; bool nxor[N]; for (int i = 0; i < N; i++) { nxor[i] = (str[i] == 'o'); } int line[N]; line[0] = 0; line[1] = 0; for (int i = 2; i < N; i++) { if (line[i-1] == 0) { line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } bool c = true; if (nxor[0] && line[N-1] != line[1])) { c = false; } if (!nxor[0] && line[N-1] == line[1])) { c = false; } if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { c = false; } if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { c = false; } if (c) { for(int i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } c = true; line[0] = 0; line[1] = -1; for (int i = 2; i < N; i++) { if (line[i-1] == 0) { line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } if (nxor[0] && line[N-1] != line[1])) { c = false; } if (!nxor[0] && line[N-1] == line[1])) { c = false; } if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { c = false; } if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { c = false; } if (c) { for(int i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } c = true; line[0] = -1; line[1] = 0; for (int i = 2; i < N; i++) { if (line[i-1] == 0) { line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } if (nxor[0] && line[N-1] == line[1])) { c = false; } if (!nxor[0] && line[N-1] != line[1])) { c = false; } if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { c = false; } if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { c = false; } if (c) { for(int i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } c = true; line[0] = -1; line[1] = -1; for (int i = 2; i < N; i++) { if (line[i-1] == 0) { line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } if (nxor[0] && line[N-1] == line[1])) { c = false; } if (!nxor[0] && line[N-1] != line[1])) { c = false; } if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { c = false; } if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { c = false; } if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { c = false; } if (c) { for(int i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } c = true; cout << -1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:37: error: expected primary-expression before ')' token 24 | if (nxor[0] && line[N-1] != line[1])) { | ^ a.cc:27:38: error: expected primary-expression before ')' token 27 | if (!nxor[0] && line[N-1] == line[1])) { | ^ a.cc:30:53: error: expected primary-expression before ')' token 30 | if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:33:14: error: expected ']' before '}' token 33 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ | ] a.cc:33:14: error: expected ')' before '}' token 33 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ~ ^ | ) a.cc:33:14: error: expected primary-expression before '}' token a.cc: At global scope: a.cc:33:19: error: expected unqualified-id before '!' token 33 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ a.cc:36:1: error: expected unqualified-id before 'if' 36 | if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { | ^~ a.cc:39:1: error: expected unqualified-id before 'if' 39 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^~ a.cc:39:13: error: expected declaration before '}' token 39 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:39:18: error: expected unqualified-id before '!' token 39 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:43:1: error: expected unqualified-id before 'if' 43 | if (c) { | ^~ a.cc:50:1: error: 'c' does not name a type 50 | c = true; | ^ a.cc:52:1: error: 'line' does not name a type 52 | line[0] = 0; | ^~~~ a.cc:53:1: error: 'line' does not name a type 53 | line[1] = -1; | ^~~~ a.cc:54:1: error: expected unqualified-id before 'for' 54 | for (int i = 2; i < N; i++) { | ^~~ a.cc:54:17: error: 'i' does not name a type 54 | for (int i = 2; i < N; i++) { | ^ a.cc:54:24: error: 'i' does not name a type 54 | for (int i = 2; i < N; i++) { | ^ a.cc:62:1: error: expected unqualified-id before 'if' 62 | if (nxor[0] && line[N-1] != line[1])) { | ^~ a.cc:65:1: error: expected unqualified-id before 'if' 65 | if (!nxor[0] && line[N-1] == line[1])) { | ^~ a.cc:68:1: error: expected unqualified-id before 'if' 68 | if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { | ^~ a.cc:71:1: error: expected unqualified-id before 'if' 71 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^~ a.cc:71:14: error: expected declaration before '}' token 71 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ a.cc:71:19: error: expected unqualified-id before '!' token 71 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ a.cc:74:1: error: expected unqualified-id before 'if' 74 | if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { | ^~ a.cc:77:1: error: expected unqualified-id before 'if' 77 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^~ a.cc:77:13: error: expected declaration before '}' token 77 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:77:18: error: expected unqualified-id before '!' token 77 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:81:1: error: expected unqualified-id before 'if' 81 | if (c) { | ^~ a.cc:88:1: error: 'c' does not name a type 88 | c = true; | ^ a.cc:90:1: error: 'line' does not name a type 90 | line[0] = -1; | ^~~~ a.cc:91:1: error: 'line' does not name a type 91 | line[1] = 0; | ^~~~ a.cc:92:1: error: expected unqualified-id before 'for' 92 | for (int i = 2; i < N; i++) { | ^~~ a.cc:92:17: error: 'i' does not name a type 92 | for (int i = 2; i < N; i++) { | ^ a.cc:92:24: error: 'i' does not name a type 92 | for (int i = 2; i < N; i++) { | ^ a.cc:101:1: error: expected unqualified-id before 'if' 101 | if (nxor[0] && line[N-1] == line[1])) { | ^~ a.cc:104:1: error: expected unqualified-id before 'if' 104 | if (!nxor[0] && line[N-1] != line[1])) { | ^~ a.cc:107:1: error: expected unqualified-id before 'if' 107 | if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { | ^~ a.cc:110:1: error: expected unqualified-id before 'if' 110 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^~ a.cc:110:14: error: expected declaration before '}' token 110 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ a.cc:110:19: error: expected unqualified-id before '!' token 110 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ a.cc:113:1: error: expected unqualified-id before 'if' 113 | if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { | ^~ a.cc:116:1: error: expected unqualified-id before 'if' 116 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^~ a.cc:116:13: error: expected declaration before '}' token 116 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:116:18: error: expected unqualified-id before '!' token 116 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:120:1: error: expected unqualified-id before 'if' 120 | if (c) { | ^~ a.cc:127:1: error: 'c' does not name a type 127 | c = true; | ^ a.cc:129:1: error: 'line' does not name a type 129 | line[0] = -1; | ^~~~ a.cc:130:1: error: 'line' does not name a type 130 | line[1] = -1; | ^~~~ a.cc:131:1: error: expected unqualified-id before 'for' 131 | for (int i = 2; i < N; i++) { | ^~~ a.cc:131:17: error: 'i' does not name a type 131 | for (int i = 2; i < N; i++) { | ^ a.cc:131:24: error: 'i' does not name a type 131 | for (int i = 2; i < N; i++) { | ^ a.cc:140:1: error: expected unqualified-id before 'if' 140 | if (nxor[0] && line[N-1] == line[1])) { | ^~ a.cc:143:1: error: expected unqualified-id before 'if' 143 | if (!nxor[0] && line[N-1] != line[1])) { | ^~ a.cc:146:1: error: expected unqualified-id before 'if' 146 | if (!line[N-1] && nxor[N-1] && line[N-2] != line[0])) { | ^~ a.cc:149:1: error: expected unqualified-id before 'if' 149 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^~ a.cc:149:14: error: expected declaration before '}' token 149 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ a.cc:149:19: error: expected unqualified-id before '!' token 149 | if (!line[N-1} && !nxor[N-1] && line[N-2] == line[0])) { | ^ a.cc:152:1: error: expected unqualified-id before 'if' 152 | if (line[N-1] && nxor[N-1] && line[N-2] == line[0])) { | ^~ a.cc:155:1: error: expected unqualified-id before 'if' 155 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^~ a.cc:155:13: error: expected declaration before '}' token 155 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:155:18: error: expected unqualified-id before '!' token 155 | if (line[N-1} && !nxor[N-1] && line[N-2] != line[0])) { | ^ a.cc:159:1: error: expected unqualified-id before 'if' 159 | if (c) { | ^~ a.cc:166:1: error: 'c' does not name a type 166 | c = true; | ^ a.cc:168:1: error: 'cout' does not name a type 168 | cout << -1 << endl; | ^~~~ a.cc:169:1: error: expected unqualified-id before 'return' 169 | return 0; | ^~~~~~ a.cc:171:1: error: expected declaration before '}' token 171 | } | ^
s858776180
p03798
C++
#include <stdio.h> #include <string.h> #include <vector> int N; char s[112345]; char temp[112345]; std::vector<std::string>res; bool Is_ans_flag = true; char ans[112345] = "-1"; void f(int pos, char string[]) { if (pos >= N) { std::string tete = string; res.push_back(tete); } else { if (s[pos] == 'o') { temp[(pos - 1) % N] = 'S', temp[pos] = 'S', temp[(pos + 1) % N] = 'S'; f(pos + 2, temp); temp[(pos - 1) % N] = 'W', temp[pos] = 'S', temp[(pos + 1) % N] = 'W'; f(pos + 2, temp); temp[(pos - 1) % N] = 'S', temp[pos] = 'W', temp[(pos + 1) % N] = 'W'; f(pos + 2, temp); temp[(pos - 1) % N] = 'W', temp[pos] = 'W', temp[(pos + 1) % N] = 'S'; f(pos + 2, temp); } if (s[pos] == 'x') { temp[(pos - 1) % N] = 'S', temp[pos] = 'S', temp[(pos + 1) % N] = 'W'; f(pos + 2, temp); temp[(pos - 1) % N] = 'W', temp[pos] = 'S', temp[(pos + 1) % N] = 'S'; f(pos + 2, temp); temp[(pos - 1) % N] = 'S', temp[pos] = 'W', temp[(pos + 1) % N] = 'S'; f(pos + 2, temp); temp[(pos - 1) % N] = 'W', temp[pos] = 'W', temp[(pos + 1) % N] = 'W'; f(pos + 2, temp); } } } int main(void) { scanf("%d%s", &N, s); f(1, ""); for (int i = 0; i < res.size(); ++i) { Is_ans_flag = true; for (int j = 1; j < N; ++j) { if (s[j] == 'o') { if (res[i][j] == 'S') { if (res[i][(j - 1) % N] != res[i][(j + 1) % N]) { Is_ans_flag = false; break; } } if (res[i][j] == 'W') { if (res[i][(j - 1) % N] == res[i][(j + 1) % N]) { Is_ans_flag = false; break; } } } if (s[j] == 'x') { if (res[i][j] == 'S') { if (res[i][(j - 1) % N] == res[i][(j + 1) % N]) { Is_ans_flag = false; break; } } if (res[i][j] == 'W') { if (res[i][(j - 1) % N] != res[i][(j + 1) % N]) { Is_ans_flag = false; break; } } } } if (Is_ans_flag == true) { res[i].copy(ans, res[i].size()); break; } } printf("%s\n", ans); return 0; }
a.cc:8:18: error: 'string' is not a member of 'std' 8 | std::vector<std::string>res; | ^~~~~~ a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 3 | #include <vector> +++ |+#include <string> 4 | a.cc:8:24: error: template argument 1 is invalid 8 | std::vector<std::string>res; | ^ a.cc:8:24: error: template argument 2 is invalid a.cc: In function 'void f(int, char*)': a.cc:16:22: error: 'string' is not a member of 'std' 16 | std::string tete = string; | ^~~~~~ a.cc:16:22: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' a.cc:17:21: error: request for member 'push_back' in 'res', which is of non-class type 'int' 17 | res.push_back(tete); | ^~~~~~~~~ a.cc:17:31: error: 'tete' was not declared in this scope 17 | res.push_back(tete); | ^~~~ a.cc: In function 'int main()': a.cc:49:14: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 49 | f(1, ""); | ^~ a.cc:50:33: error: request for member 'size' in 'res', which is of non-class type 'int' 50 | for (int i = 0; i < res.size(); ++i) | ^~~~ a.cc:57:40: error: invalid types 'int[int]' for array subscript 57 | if (res[i][j] == 'S') | ^ a.cc:59:48: error: invalid types 'int[int]' for array subscript 59 | if (res[i][(j - 1) % N] != res[i][(j + 1) % N]) | ^ a.cc:59:71: error: invalid types 'int[int]' for array subscript 59 | if (res[i][(j - 1) % N] != res[i][(j + 1) % N]) | ^ a.cc:65:40: error: invalid types 'int[int]' for array subscript 65 | if (res[i][j] == 'W') | ^ a.cc:67:48: error: invalid types 'int[int]' for array subscript 67 | if (res[i][(j - 1) % N] == res[i][(j + 1) % N]) | ^ a.cc:67:71: error: invalid types 'int[int]' for array subscript 67 | if (res[i][(j - 1) % N] == res[i][(j + 1) % N]) | ^ a.cc:76:40: error: invalid types 'int[int]' for array subscript 76 | if (res[i][j] == 'S') | ^ a.cc:78:48: error: invalid types 'int[int]' for array subscript 78 | if (res[i][(j - 1) % N] == res[i][(j + 1) % N]) | ^ a.cc:78:71: error: invalid types 'int[int]' for array subscript 78 | if (res[i][(j - 1) % N] == res[i][(j + 1) % N]) | ^ a.cc:84:40: error: invalid types 'int[int]' for array subscript 84 | if (res[i][j] == 'W') | ^ a.cc:86:48: error: invalid types 'int[int]' for array subscript 86 | if (res[i][(j - 1) % N] != res[i][(j + 1) % N]) | ^ a.cc:86:71: error: invalid types 'int[int]' for array subscript 86 | if (res[i][(j - 1) % N] != res[i][(j + 1) % N]) | ^ a.cc:96:28: error: invalid types 'int[int]' for array subscript 96 | res[i].copy(ans, res[i].size()); | ^ a.cc:96:45: error: invalid types 'int[int]' for array subscript 96 | res[i].copy(ans, res[i].size()); | ^
s379375132
p03798
C++
#include<bits/stdc++.h> using namespace std; int main() { int N; string str; cin >> N >> str; bool nxor[N]; for (int i = 0; i < N; i++) { nxor[i] = (str[i] == 'o'); } int line[N]; line[0] = 0; line[1] = 0; for (int i = 2; i < N; i++) { if (line[i-1] == 0) { line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } if (nxor[0]) { if (line[N-1] == line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } else { if (line[N-1] != line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } line[0] = 0; line[1] = -1; for (int i = 2; i < N; i++) { if (line[i-1] == 0) [ line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } if (nxor[0]) { if (line[N-1] == line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } else { if (line[N-1] != line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } line[0] = -1; line[1] = 0; for (int i = 2; i < N; i++) { if (line[i-1] == 0) [ line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } if (nxor[0]) { if (line[N-1] == line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } else { if (line[N-1] != line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } line[0] = -1; line[1] = -1; for (int i = 2; i < N; i++) { if (line[i-1] == 0) [ line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); } else { line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); } } if (nxor[0]) { if (line[N-1] == line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } else { if (line[N-1] != line[1]) { for(i = 0; i < N; i++) { cout << (!line[i] ? 'S' : 'W'); } cout << endl; return 0; } } cout << -1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:5: error: 'i' was not declared in this scope 25 | for(i = 0; i < N; i++) { | ^ a.cc:34:5: error: 'i' was not declared in this scope 34 | for(i = 0; i < N; i++) { | ^ a.cc:45:1: error: array of runtime bound cannot be captured by copy, only by reference 45 | line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); | ^~~~ a.cc:45:5: error: expected ',' before '[' token 45 | line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); | ^ | , a.cc:45:5: error: expected identifier before '[' token a.cc:45:47: error: expected ']' before ';' token 45 | line[i] = (nxor[i-1] ? line[i-2] : ~line[i-2]); | ^ | ] a.cc: In lambda function: a.cc:45:47: error: expected '{' before ';' token a.cc: In function 'int main()': a.cc:47:1: error: 'else' without a previous 'if' 47 | else { | ^~~~ a.cc:48:6: error: 'i' was not declared in this scope 48 | line[i] = (nxor[i-1] ? ~line[i-2] : line[i-2]); | ^ a.cc: At global scope: a.cc:51:1: error: expected unqualified-id before 'if' 51 | if (nxor[0]) { | ^~ a.cc:60:1: error: expected unqualified-id before 'else' 60 | else { | ^~~~ a.cc:70:1: error: 'line' does not name a type 70 | line[0] = -1; | ^~~~ a.cc:71:1: error: 'line' does not name a type 71 | line[1] = 0; | ^~~~ a.cc:72:1: error: expected unqualified-id before 'for' 72 | for (int i = 2; i < N; i++) { | ^~~ a.cc:72:17: error: 'i' does not name a type 72 | for (int i = 2; i < N; i++) { | ^ a.cc:72:24: error: 'i' does not name a type 72 | for (int i = 2; i < N; i++) { | ^ a.cc:76:1: error: expected unqualified-id before 'else' 76 | else { | ^~~~ a.cc:79:1: error: expected declaration before '}' token 79 | } | ^ a.cc:80:1: error: expected unqualified-id before 'if' 80 | if (nxor[0]) { | ^~ a.cc:89:1: error: expected unqualified-id before 'else' 89 | else { | ^~~~ a.cc:99:1: error: 'line' does not name a type 99 | line[0] = -1; | ^~~~ a.cc:100:1: error: 'line' does not name a type 100 | line[1] = -1; | ^~~~ a.cc:101:1: error: expected unqualified-id before 'for' 101 | for (int i = 2; i < N; i++) { | ^~~ a.cc:101:17: error: 'i' does not name a type 101 | for (int i = 2; i < N; i++) { | ^ a.cc:101:24: error: 'i' does not name a type 101 | for (int i = 2; i < N; i++) { | ^ a.cc:105:1: error: expected unqualified-id before 'else' 105 | else { | ^~~~ a.cc:108:1: error: expected declaration before '}' token 108 | } | ^ a.cc:109:1: error: expected unqualified-id before 'if' 109 | if (nxor[0]) { | ^~ a.cc:118:1: error: expected unqualified-id before 'else' 118 | else { | ^~~~ a.cc:127:1: error: 'cout' does not name a type 127 | cout << -1 << endl; | ^~~~ a.cc:128:1: error: expected unqualified-id before 'return' 128 | return 0; | ^~~~~~ a.cc:130:1: error: expected declaration before '}' token 130 | } | ^
s199980432
p03798
C
#include <stdio.h> int main(void){ int how; scanf("%d\n",&how); char data[how]; int loop1; int how_x=0; for(loop1=0;loop1<how;loop1++){ scanf("%c",&data[loop1]); if(data[loop1]=='x')how_batu++; } if(x%2==1){ printf("-1\n"); return 0; } }
main.c: In function 'main': main.c:10:29: error: 'how_batu' undeclared (first use in this function) 10 | if(data[loop1]=='x')how_batu++; | ^~~~~~~~ main.c:10:29: note: each undeclared identifier is reported only once for each function it appears in main.c:12:8: error: 'x' undeclared (first use in this function) 12 | if(x%2==1){ | ^
s273922026
p03798
C++
#include<iostream> #include<bits/stdc++.h> #define pq priority_queue #define Pi acos(-1.0) using namespace std; #define INFF 10000000007 #define MOD 1000000007 char s[100005]; int len; bool life[100005],flag=0; bool ok(bool x,bool y); { life[0]=x; life[1]=y; for(int i=1;i<len;i++) { if(s[i]=='O') { if(life[i]) life[i+1]=!life[i-1]; else life[i+1]=life[i-1]; } else { if(life[i]==0) life[i+1]=!life[i-1]; else life[i+1]=life[i-1]; } } if(s[0]=='O') { if(life[i]) return life[1]!=life[len]; else return life[1]==life[len]; } else { if(life[i]) return life[1]==life[len]; else return life[1]!=life[len]; } } int main() { scanf("%s",s); len=strlen(s); len--; if(ok(0,0)) flag=1; else { if(ok(0,1)) flag=1; else { if(ok(1,0)) flag=1; else flag=ok(1,1); } } if(!flag) printf("-1\n"); else { for(int i=0;i<=len;i++) { if(life[i]) printf("W"); else printf("S"); } printf("\n"); } return 0; }
a.cc:12:1: error: expected unqualified-id before '{' token 12 | { | ^
s890186782
p03799
C++
#include<bits/stdc++.h> //#include<atcoder/all> using namespace std; //using namespace atcoder; #define rep(i,n) for(ll i=0;i<n;i++) #define repl(i,l,r) for(ll i=(l);i<(r);i++) #define per(i,n) for(ll i=n-1;i>=0;i--) #define perl(i,r,l) for(ll i=r-1;i>=l;i--) #define fi first #define se second #define pb push_back #define ins insert #define all(x) (x).begin(),(x).end() using ll=long long; using vl=vector<ll>; using vvl=vector<vector<ll>>; const ll MOD=1000000007; const ll MOD9=998244353; const int inf=1e9+10; const ll INF=4e18; const ll dy[8]={1,0,-1,0,1,1,-1,-1}; const ll dx[8]={0,-1,0,1,1,-1,1,-1}; using Graph = vector<vector<int>>; // dijkstra  struct edge{ll to, cost;}; typedef pair<ll,ll> P; struct graph{ ll V; vector<vector<edge> > G; vector<ll> d; graph(ll n){ init(n); } void init(ll n){ V = n; G.resize(V); d.resize(V); rep(i,V){ d[i] = INF; } } void add_edge(ll s, ll t, ll cost){ edge e; e.to = t, e.cost = cost; G[s].push_back(e); } void dijkstra(ll s){ rep(i,V){ d[i] = INF; } d[s] = 0; priority_queue<P,vector<P>, greater<P> > que; que.push(P(0,s)); while(!que.empty()){ P p = que.top(); que.pop(); ll v = p.second; if(d[v]<p.first) continue; for(auto e : G[v]){ if(d[e.to]>d[v]+e.cost){ d[e.to] = d[v]+e.cost; que.push(P(d[e.to],e.to)); } } } } }; // dijkstra end class UnionFind { public: ll par[200005]; ll depth[200005]; ll nGroup[200005]; UnionFind(ll n) { init(n); } void init(ll n) { for(ll i=0; i<n; i++) { par[i] = i; depth[i] = 0; nGroup[i] = 1; } } ll root(ll x) { if(par[x] == x) { return x; } else { return par[x] = root(par[x]); } } bool same(ll x, ll y) { return root(x) == root(y); } void unite(ll x, ll y) { x = root(x); y = root(y); if(x == y) return; if(depth[x] < depth[y]) { par[x] = y; nGroup[y] += nGroup[x]; nGroup[x] = 0; } else { par[y] = x; nGroup[x] += nGroup[y]; nGroup[y] = 0; if(depth[x] == depth[y]) depth[x]++; } } }; // unionfind end // nCr const ll MAX = 500010; ll fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (ll i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // nCr end // tree DP vector<ll> depth; vector<ll> f; vector<ll> g; void dfs(const Graph &G, ll v, ll p, ll d) { depth[v] = d; for (auto nv : G[v]) { if (nv == p) continue; dfs(G, nv, v, d+1); } f[v] = 1; g[v] = 1; for (auto c : G[v]) { if (c == p) continue; f[v]*=g[c]; f[v]%=MOD; g[v]*=f[c]; g[v]%=MOD; } f[v]+=g[v]; f[v]%=MOD; } // tree DP end template<ll MOD> struct Fp { ll val; constexpr Fp(ll v = 0) noexcept : val(v % MOD) { if (val < 0) val += MOD; } constexpr ll getmod() { return MOD; } constexpr Fp operator - () const noexcept { return val ? MOD - val : 0; } constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; } constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; } constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; } constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; } constexpr Fp& operator += (const Fp& r) noexcept { val += r.val; if (val >= MOD) val -= MOD; return *this; } constexpr Fp& operator -= (const Fp& r) noexcept { val -= r.val; if (val < 0) val += MOD; return *this; } constexpr Fp& operator *= (const Fp& r) noexcept { val = val * r.val % MOD; return *this; } constexpr Fp& operator /= (const Fp& r) noexcept { ll a = r.val, b = MOD, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } val = val * u % MOD; if (val < 0) val += MOD; return *this; } constexpr bool operator == (const Fp& r) const noexcept { return this->val == r.val; } constexpr bool operator != (const Fp& r) const noexcept { return this->val != r.val; } friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept { return os << x.val; } friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, ll n) noexcept { if (n == 0) return 1; auto t = modpow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; using mint = Fp<MOD>; mint calc(ll N, ll K) { mint res = 1; for (ll n = 0; n < K; ++n) { res *= (N - n); res /= (n + 1); } return res; } mint COM(ll n, ll k){ if (k == 0) return 1; if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } int main(){ ll n,m; cin>>n>>m; cout << min((2*n+m)/4,m/2); << endl; }
a.cc: In function 'int main()': a.cc:245:31: error: expected primary-expression before '<<' token 245 | cout << min((2*n+m)/4,m/2); << endl; | ^~
s571321210
p03799
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0;i < n;i++) using ll = long long; int main(){ ll n,m; cin >n >>m; if(2*n>m) cout << m/2 << endl; else cout << n+(m-n*2)/4 << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'll' {aka 'long long int'}) 7 | ll n,m; cin >n >>m; | ~~~ ^~~~~~ | | | | | ll {aka long long int} | std::istream {aka std::basic_istream<char>} a.cc:7:15: note: candidate: 'operator>(int, ll {aka long long int})' (built-in) 7 | ll n,m; cin >n >>m; | ~~~~^~~~~~ a.cc:7:15: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:7:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'} 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:7:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'll' {aka 'long long int'} 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 7 | ll n,m; cin >n >>m; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 7 | ll n,m; cin >n >>m; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 7 | ll n,m; cin >n >>m; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:7:20: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:7:20: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 7 | ll n,m; cin >n >>m; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/in
s219929084
p03799
C++
#include <bits/stdc++.h> #include <string.h> #include <vector> //s#define rep(i, n) for (int i = 0; i < (n); i++) #define MAX 10000 using namespace std; #define ll long long #define pb push_back #define mp make_pair #define all(a) (a).begin(),(a).end() #define rep(i,a,n) for(int i=a; i<n; i++) #define r0 return 0 #define INF (int)1e15 #define MOD 1000000007 int gcd(int a,int b){ if(a%b == 0) return b; else return gcd(b,a%b); } long long numbers[500005]; int main(){ long long n,m; cin>>n>>m; if(m-2*n > 0){ ans = n; ans += (m-n*2)/4; } else { ans += m/2; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:37:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 37 | ans = n; | ^~~ | abs a.cc:41:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 41 | ans += m/2; | ^~~ | abs a.cc:44:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 44 | cout<<ans<<endl; | ^~~ | abs
s133062678
p03799
C++
gg
a.cc:1:1: error: 'gg' does not name a type 1 | gg | ^~
s573026981
p03799
C++
#include <bits/stdc++.h> using namespace std; //long long using ll = long long; // pair<int, int> using PII = pair<int, int>; //最大値、mod const int MOD = 1000000007; const int mod = 1000000007; const int INF = 1000000000; const long long LINF = 1e18; const int MAX = 510000; //出力系 #define print(x) cout << x << endl #define prints(x) cout << fixed << setprecision(20) << x << endl #define printc(x) cout << setw(2) << setfill('0') << x << endl; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl // begin() end() #define all(x) (x).begin(),(x).end() //for #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define rep(i,a,b) for(int i=(a);i<(b);i++) //最大公約数 unsigned gcd(unsigned a, unsigned b) { if(a < b) return gcd(b, a); unsigned r; while ((r=a%b)) { a = b; b = r; } return b; } // 最小公倍数 unsigned lcm(unsigned a, unsigned b){ return a / gcd(a, b) * b; } // a = max(a, b), a = min(a, b) 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; } // 階乗(MODをとる) ll pow_mod(ll num, ll pow, ll mod) { ll prod = 1; num %= mod; while (pow > 0) { if (pow & 1) prod = prod * num % mod; num = num * num % mod; pow >>= 1; } return prod; } // 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度) // COMinit() // COM(x, y) // とコンビで使う // テーブルを作る前処理 long long fac[MAX], finv[MAX], inv[MAX]; void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } // UnionFind struct UnionFind { vector<int> par; vector<int> rank; vector<ll> Size; UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1); for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } 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 (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; Size[x] += Size[y]; return true; } ll size(int x){ return Size[root(x)]; } }; //modint構造体 struct Mint { int val; Mint inv() const{ int tmp,a=val,b=mod,x=1,y=0; while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y); return Mint(x); } public: Mint():val(0){} Mint(ll x){if((val=x%mod)<0)val+=mod;} Mint pow(ll t){Mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;} Mint& operator+=(const Mint& x){if((val+=x.val)>=mod)val-=mod;return *this;} Mint& operator-=(const Mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;} Mint& operator*=(const Mint& x){val=(ll)val*x.val%mod; return *this;} Mint& operator/=(const Mint& x){return *this*=x.inv();} bool operator==(const Mint& x) const{return val==x.val;} bool operator!=(const Mint& x) const{return val!=x.val;} bool operator<(const Mint& x) const{return val<x.val;} bool operator<=(const Mint& x) const{return val<=x.val;} bool operator>(const Mint& x) const{return val>x.val;} bool operator>=(const Mint& x) const{return val>=x.val;} Mint operator+(const Mint& x) const{return Mint(*this)+=x;} Mint operator-(const Mint& x) const{return Mint(*this)-=x;} Mint operator*(const Mint& x) const{return Mint(*this)*=x;} Mint operator/(const Mint& x) const{return Mint(*this)/=x;} }; struct factorial { vector<Mint> Fact, Finv; public: //factorial fact(10000010); //fact.nCr(a, b) //「fact」の部分は自由に名前変更可能 factorial(int maxx){ Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1); Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i; } Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];} Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];} Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];} }; // 1 * 2 * 3 .... * n (mod) ll modfact(ll n) { if (n <= 1) return 1; return (n * modfact(n - 1)) % MOD; } // kが角度だった場合:cos(k * (PI / 180)); const double PI = acos(-1); // 多次元 vector 生成 例: auto dp = make_vec<long long>(N+1, 5, 5, 5); template<class T> vector<T> make_vec(size_t a){ return vector<T>(a); } template<class T, class... Ts> auto make_vec(size_t a, Ts... ts){ return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...)); } //int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; int main(){ ll n; cin >> n; ll m; cin >> m; ll ans = min(n, M / 2); m -= ans * 2; if(M >= 4) ans += M / 4; print(ans); return 0; }
a.cc: In function 'int main()': a.cc:216:21: error: 'M' was not declared in this scope 216 | ll ans = min(n, M / 2); | ^
s902251393
p03799
C++
#include <bits/stdc++.h> #include <stdlib.h> using namespace std; typedef long long ll; typedef pair<int,int> P; typedef pair<ll,ll> llP; int main() { ll n,m; cin>>n>>m; if(2*n>=m) cout<<m/2<endl; else cout<<n+(m-2*n)/2<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:23: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 11 | if(2*n>=m) cout<<m/2<endl; | ~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1317 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed: a.cc:11:24: note: couldn't deduce template parameter '_Bi_iter' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1485 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed: a.cc:11:24: note: couldn't deduce template parameter '_Bi_iter' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1660 | operator<(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:11:24: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:11:24: note: couldn't deduce template parameter '_CharT' 11 | if(2*n>=m) cout<<m/2<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Trai
s274560758
p03799
C++
using namespace std; int main() { long long n,m; cin>>n>>m; int64_t count=0; if(n>=2*m){ count=m/2; }else{ m-=2*n; count=n+m/4; } cout<<count<<endl; }
a.cc: In function 'int main()': a.cc:5:5: error: 'cin' was not declared in this scope 5 | cin>>n>>m; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:6:5: error: 'int64_t' was not declared in this scope 6 | int64_t count=0; | ^~~~~~~ a.cc:1:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' +++ |+#include <cstdint> 1 | using namespace std; a.cc:8:9: error: 'count' was not declared in this scope 8 | count=m/2; | ^~~~~ a.cc:11:9: error: 'count' was not declared in this scope 11 | count=n+m/4; | ^~~~~ a.cc:13:5: error: 'cout' was not declared in this scope 13 | cout<<count<<endl; | ^~~~ a.cc:13:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:13:11: error: 'count' was not declared in this scope 13 | cout<<count<<endl; | ^~~~~ a.cc:13:18: error: 'endl' was not declared in this scope 13 | cout<<count<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std;
s064048190
p03799
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll a,c; cin >> a >> c; cout << c>=2*a?(a+(c-2*a)/4):a <<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:14: error: no match for 'operator>=' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and 'long long int') 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ~~~~~~~~~^~~~~ | | | | | long long int | std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>} a.cc:17:14: note: candidate: 'operator>=(int, long long int)' (built-in) 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ~~~~~~~~~^~~~~ a.cc:17:14: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:476:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 476 | operator>=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:476:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:520:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 520 | operator>=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:520:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1724:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1724 | operator>=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1724:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1781:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1781 | operator>=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1781:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1070:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1070 | operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1070:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:739:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 739 | operator>=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:739:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/string_view:746: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> >)' 746 | operator>=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:746:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/string_view:754: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>)' 754 | operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:754:5: note: template argument deduction/substitution failed: a.cc:17:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'long long int' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/bits/basic_string.h:3997: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>&)' 3997 | operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3997:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/bits/basic_string.h:4011:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 4011 | operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4011:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ /usr/include/c++/14/bits/basic_string.h:4024:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4024 | operator>=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4024:5: note: template argument deduction/substitution failed: a.cc:17:18: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2631:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2631 | operator>=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2631:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:2114:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2114 | operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2114:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::vector<_Tp, _Alloc>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; | ^ In file included from /usr/include/c++/14/deque:66, from /usr/include/c++/14/queue:62, from a.cc:6: /usr/include/c++/14/bits/stl_deque.h:2363:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>=(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)' 2363 | operator>=(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_deque.h:2363:5: note: template argument deduction/substitution failed: a.cc:17:18: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::deque<_Tp, _Alloc>' 17 | cout << c>=2*a?(a+(c-2*a)/4):a <<endl; |
s888365803
p03799
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll a,b; cin >> a >> b; cout << max(min(a,c/2),a+(c-2*a)/3); return 0; }
a.cc: In function 'int main()': a.cc:17:23: error: 'c' was not declared in this scope 17 | cout << max(min(a,c/2),a+(c-2*a)/3); | ^
s209536426
p03799
C++
#include<bits//stc++.h> using namespace std; typedef long long ll; ll l,x,y,s = 0,d,n,m; int main() { cin >> n >> m; if (2*n >= m) { cout << m / 2 << endl; } else { cout << n + (m - 2 * n) / 4 << endl; } }
a.cc:1:9: fatal error: bits//stc++.h: No such file or directory 1 | #include<bits//stc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s506489675
p03799
C++
n, m = map(int, input().split()) cnt = 0 if n*2 <= m: m -= n*2 cnt += n + m//4 else: cnt += m//2 print(cnt)
a.cc:1:1: error: 'n' does not name a type 1 | n, m = map(int, input().split()) | ^
s291034927
p03799
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int answer = 0; if(n <= 2*m){ answer = answer + n + (m-2*n)/4; } else { answer = answer + n } cout << answer << endl; }
a.cc: In function 'int main()': a.cc:11:28: error: expected ';' before '}' token 11 | answer = answer + n | ^ | ; 12 | } | ~
s365970786
p03799
C
#include<stdio.h> #include<algorithm> #define ll long long using namespace std; int main() { ll a,b;scanf("%lld%lld",&a,&b); printf("%lld\n",a + (b - a * 2) / 4); return 0; }
main.c:2:9: fatal error: algorithm: No such file or directory 2 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s748310818
p03799
C++
1 6
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1 6 | ^
s945606598
p03799
C
import java.util.Scanner; class Main{ static Scanner scan=new Scanner(System.in); public static void main(String args[]){ long n=scan.nextLong(); long m=scan.nextLong(); long x=n*2+m; System.out.println(x/4); } }
main.c:1:1: error: unknown type name 'import' 1 | import java.util.Scanner; | ^~~~~~ main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import java.util.Scanner; | ^ main.c:3:1: error: unknown type name 'class' 3 | class Main{ | ^~~~~ main.c:3:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token 3 | class Main{ | ^
s836742100
p03799
C
#include<iostream> #include<stdio.h> #include<vector> #include<stdlib.h> #include<algorithm> #include<string> #include<string.h> #include<queue> using namespace std; int main(){ long long n,m; cin >> n >> m; cout << min(n,m/2)+max((long long)0,m-2*n)/4 << endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s004553224
p03799
C++
#include<iostream> using namespace std; int main(){ int N,M,x; cin>>n>>m; x=N*2; M=x+M; cout<<M/4; }
a.cc: In function 'int main()': a.cc:5:14: error: 'n' was not declared in this scope 5 | cin>>n>>m; | ^ a.cc:5:17: error: 'm' was not declared in this scope 5 | cin>>n>>m; | ^
s835150163
p03799
C++
#include<iostream> #include<vector> #include<algorithm> #include<utility> using namespace std; typedef pair<int, int> P; int main(){ ll n, m;cin>>n>>m; if(ll(2)*n<=m)cout<<n+(m-ll(2)*n)/ll(4)<<endl; else cout<<m/ll(2)<<endl; }
a.cc: In function 'int main()': a.cc:10:3: error: 'll' was not declared in this scope 10 | ll n, m;cin>>n>>m; | ^~ a.cc:10:16: error: 'n' was not declared in this scope 10 | ll n, m;cin>>n>>m; | ^ a.cc:10:19: error: 'm' was not declared in this scope; did you mean 'tm'? 10 | ll n, m;cin>>n>>m; | ^ | tm
s864961419
p03799
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, m; int main() { ios::sync_with_stdio(false), cin.tie(0); cin >> n >> m; ll t = max(0LL, (2 * m - n + 4) / 5); n += t; m -= 2t; cout << min(n, m / 2) << "\n"; }
a.cc: In function 'int main()': a.cc:12:10: error: unable to find numeric literal operator 'operator""t' 12 | m -= 2t; | ^~
s262465163
p03799
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, m; int main() { ios::sync_with_stdio(false), cin.tie(0); cin >> n >> m; ll t = max(0, (2 * m - n + 4) / 5); n += t; m -= 2t; cout << min(n, m / 2) << "\n"; }
a.cc: In function 'int main()': a.cc:10:16: error: no matching function for call to 'max(int, ll)' 10 | ll t = max(0, (2 * m - n + 4) / 5); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:10:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 10 | ll t = max(0, (2 * m - n + 4) / 5); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:10:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 10 | ll t = max(0, (2 * m - n + 4) / 5); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ a.cc:12:10: error: unable to find numeric literal operator 'operator""t' 12 | m -= 2t; | ^~
s148511839
p03799
C
#include<stdio.h> int main(){ long long int N,M; scanf("%lld %dll", &N, &M); if(n*2=>m){ printf("%lld\n", m/2); } else{ printf("%lld\n", n+(m-n*2)/4); } retrun 0; }
main.c: In function 'main': main.c:7:7: error: 'n' undeclared (first use in this function) 7 | if(n*2=>m){ | ^ main.c:7:7: note: each undeclared identifier is reported only once for each function it appears in main.c:7:11: error: expected expression before '>' token 7 | if(n*2=>m){ | ^ main.c:8:23: error: 'm' undeclared (first use in this function) 8 | printf("%lld\n", m/2); | ^ main.c:13:4: error: 'retrun' undeclared (first use in this function) 13 | retrun 0; | ^~~~~~ main.c:13:10: error: expected ';' before numeric constant 13 | retrun 0; | ^~ | ;
s218697608
p03799
C++
#include<bits/stdc++.h> using namespace std; #define REP(i,n) for(long long i=0;i<n;i++) #define REP1(i,n) for(long long i=1;i<=n;i++) #define REPB(i,n) for(long long i=((n)-1);i>=0;i--) #define REPB1(i,n) for(long long i=(n);i>0;i--) #define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();ite++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define YNPRT(b) cout<<((b)?"Yes":"No")<<endl #define REV(arr) reverse(ALL(arr)) typedef long long ll; typedef pair<int,int> pii; //--------------------- #define MAXN 100000 //--------------------- ll nums,numc; int main(){ cin>>nums>>numc; numc>>=1; cout<<(nums>numc)?(numc):((nums+numc)>>1)<<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:50: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator<<' 22 | cout<<(nums>numc)?(numc):((nums+numc)>>1)<<endl; | ~~~~~~~~~~~~~~~~^~~~~~
s229182260
p03799
C++
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> using namespace std; #define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; typedef pair<int,int> pint; typedef pair<ll,int> pli; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; int main(){ ll n,m; cin >> n >> m; cout << max(n,n+(2*m-n)/4 << endl; return 0;}
a.cc: In function 'int main()': a.cc:27:27: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator<<' 27 | cout << max(n,n+(2*m-n)/4 << endl; | ~~~~~~~~~~~~^~~~~~~
s109813925
p03799
C++
#include<bits/stdc++.h> using namespace std; /* Bismillahir Rahmanir Rahim Problem : Problem Link : Topics : Solver : Masud Parves I Love Code More than Sharks Love Blood <3 */ #define ff first #define ss second #define pb push_back #define mp make_pair #define SZ(a) (int)a.size() #define all(a) a.begin(), a.end() #define allr(a) a.rbegin(), a.rend() #define sf(a) scanf("%d",&a) #define sff(a,b) scanf("%d %d",&a,&b) #define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c) #define f0(i,b) for(int i=0;i<(b);i++) #define f1(i,b) for(int i=1;i<=(b);i++) #define f2(i,a,b) for(int i=(a);i<=(b);i++) #define fr(i,b,a) for(int i=(b);i>=(a);i--) #define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); #define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++) #define PRINT_CASE printf("Case %d: ",zz) #define Debug(x) cout<<#x " = "<<(x)<<endl #define NOT_VISITED 0 #define IS_VISITED 1 #define WHITE 0 #define GRAY 1 #define BLACK 2 int fx[4]= {1,-1,0,0}; int fy[4]= {0,0,1,-1}; /*-----------------------Bitmask------------------*/ //int Set(int N,int pos){return N=N (1<<pos);} //int Reset(int N,int pos){return N= N & ~(1<<pos);} //bool Check(int N,int pos){return (bool)(N & (1<<pos));} /*------------------------------------------------*/ const double PI = acos(-1.0); const double EPS = 1e-6; const int MOD = (int)1e9+7; const int maxn = (int)2e5+5; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> pii; typedef pair<ll, int> plli; typedef pair<int, ll> pill; int main() { CIN //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); l S,C; cin >> S >> C; ll total=0LL; if(C>=S*2){ total += S; int rem = C-S*2; total+=rem/4; }else { total = C/2; } cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:74:5: error: 'l' was not declared in this scope; did you mean 'll'? 74 | l S,C; | ^ | ll a.cc:75:12: error: 'S' was not declared in this scope; did you mean 'SZ'? 75 | cin >> S >> C; | ^ | SZ a.cc:75:17: error: 'C' was not declared in this scope 75 | cin >> S >> C; | ^
s424812874
p03799
C++
#include <bits/stdc++.h> using namespace std; int main() { int S_NUM, C_NUM; cin >> S_NUM >> C_NUM; // Sの数だけsccパターンを作る // SがN個あったら、Cは2N個必要 // C_NUM < 2N のときは (C_NUM / 2)個作れる int scc_num_1 = min(S_NUM, C_NUM / 2); if(2 * S_NUM > C_NUM) { cout << C_NUM / 2 << endl; return; } // あまったcでsccパターンを作る // Cのみでsccパターンを作るためには4つのCが必要になる int rest_c_num = max(C_NUM - (2 * S_NUM), 0); int scc_num_2 = rest_c_num / 4; // SCC_NUM_1とSCC_NUM_2を合計した数が総scc数 int result = scc_num_1 + scc_num_2; cout << result << endl; }
a.cc: In function 'int main()': a.cc:14:5: error: return-statement with no value, in function returning 'int' [-fpermissive] 14 | return; | ^~~~~~
s432145136
p03799
C++
N,M = map(int,input().split()) count=0 if N*2<=M: count = N M -= N*2 else: count = M/2 M = 0 count += M//4 print(count)
a.cc:1:1: error: 'N' does not name a type 1 | N,M = map(int,input().split()) | ^
s809135520
p03799
C++
#include <stdio.h> #define ll long long using namespace std; ll lin() {ll x;scanf("%lld",&x);return x;} int main(){ ll n=lin(); cout<<max(-2*n+lin(),0ll)/4+n<<endl; }
a.cc: In function 'int main()': a.cc:7:5: error: 'cout' was not declared in this scope 7 | cout<<max(-2*n+lin(),0ll)/4+n<<endl; | ^~~~ a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <stdio.h> +++ |+#include <iostream> 2 | #define ll long long a.cc:7:11: error: 'max' was not declared in this scope 7 | cout<<max(-2*n+lin(),0ll)/4+n<<endl; | ^~~ a.cc:7:36: error: 'endl' was not declared in this scope 7 | cout<<max(-2*n+lin(),0ll)/4+n<<endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include <stdio.h> +++ |+#include <ostream> 2 | #define ll long long
s757470124
p03799
C
def fun(): print('ac') print('ac') print('ac') print('ac') N,M=map(int,input().split()) if N*2>=M: print(M//2) else: result=N+(M-2*N)//4 print(result)
main.c:1:1: error: unknown type name 'def' 1 | def fun(): | ^~~ main.c: In function 'fun': main.c:1:10: error: expected declaration specifiers before ':' token 1 | def fun(): | ^ main.c:2:12: warning: multi-character character constant [-Wmultichar] 2 | print('ac') | ^~~~ main.c:3:12: warning: multi-character character constant [-Wmultichar] 3 | print('ac') | ^~~~ main.c:4:12: warning: multi-character character constant [-Wmultichar] 4 | print('ac') | ^~~~ main.c:5:12: warning: multi-character character constant [-Wmultichar] 5 | print('ac') | ^~~~
s560497705
p03799
C
#include<bits/stdc++.h> using namespace std; int main() { long long a, b, c=0; cin>>b>>a; if(2*b<=a) { c+=b; if(a%2==0) a-=2*b; else a-=2*b; while(a>=4) { c++;a-=4; } } else if(2*b>a) { c+=a/2; } cout<<c<<endl; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s105341783
p03799
C++
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define ll long long #define pii pair <int, int> #define X first #define Y second using namespace std; const int OFF = (1 << 15); vector <int> ve[OFF * 2]; int bio[2 * OFF], low[2 * OFF], scc[2 * OFF]; int cnt = 0, ind = 0, n; stack <int> st; int on_stack[2 * OFF]; int index[2 * OFF]; vector <pii> tmp; void dfs(int x) { bio[x] = low[x] = cnt++; st.push(x); on_stack[x] = 1; for (int y : ve[x]) { if (bio[y] == -1) { dfs(y); low[x] = min(low[x], low[y]); } else if (on_stack[y]) { low[x] = min(low[x], bio[y]); } } if (low[x] == bio[x]) { while (st.size()) { int y = st.top(); st.pop(); on_stack[y] = 0; scc[y] = ind; if (y == x) break; } ind++; } return; } void tarjan(int N) { cnt = 1, ind = 0; memset(scc, -1, sizeof scc); memset(bio, -1, sizeof bio); REP(i, N) { if (bio[i] == -1) dfs(i); } return; } void connect(int a, int b, int k, int lo = 0, int hi = OFF, int x = 1) { if (b <= lo || hi <= a) return; if (a <= lo && hi <= b) { ve[k].push_back(x); return; } int mi = (lo + hi) / 2; connect(a, b, k, lo, mi, x * 2); connect(a, b, k, mi, hi, x * 2 + 1); return; } void generate(int D) { REP(i, OFF) ve[i + OFF].clear(); int l = 0, r = 0; REP(i, 2 * n) { while (tmp[l].X < tmp[i].X - D) l++; while (r < 2 * n && tmp[r].X <= tmp[i].X + D) r++; connect(l + 2 * n, i + 2 * n, i + OFF); connect(i + 1 + 2 * n, r + 2 * n, i + OFF); } REP(i, n) { int a = index[2 * i]; int b = index[2 * i + 1]; ve[a + OFF].push_back(b + 2 * n + OFF); ve[b + OFF].push_back(a + 2 * n + OFF); ve[b + 2 * n + OFF].push_back(a + OFF); ve[a + 2 * n + OFF].push_back(b + OFF); } return; } bool check(int mi) { generate(mi); tarjan(2 * OFF); bool flag = 1; REP(i, 2 * n) { if (scc[i + OFF] == scc[i + 2 * n + OFF]) flag = 0; } return flag; } int main() { ios_base::sync_with_stdio(false); FOR(i, 1, OFF) { ve[i].push_back(i * 2); ve[i].push_back(i * 2 + 1); } cin >> n; REP(i, 2 * n) { int a; cin >> a; tmp.push_back({a, i}); } sort(tmp.begin(), tmp.end()); REP(i, 2 * n) index[tmp[i].Y] = i; /* generate(3); FOR(i, OFF, 2 * OFF) { cout << i << ": "; for (int x : ve[i]) cout << x << " "; cout << endl; } tarjan(2 * OFF); REP(i, 2 * n) { cout << scc[i + OFF] << " " << scc[i + 2 * n + OFF] << endl; } */ int lo = 0, hi = 1e9; while (lo < hi) { int mi = (lo + hi + 1) / 2; if (check(mi)) lo = mi; else hi = mi - 1; } if (lo == 0 && !check(0)) cout << 0 << endl; else cout << lo + 1 << endl; return 0; }
a.cc:18:18: error: 'int index [65536]' redeclared as different kind of entity 18 | int index[2 * OFF]; | ^ In file included from /usr/include/string.h:462, from /usr/include/c++/14/cstring:43, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121, from a.cc:1: /usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)' 50 | extern const char *index (const char *__s, int __c) | ^~~~~ a.cc: In function 'void generate(int)': a.cc:88:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 88 | int a = index[2 * i]; | ^ a.cc:89:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 89 | int b = index[2 * i + 1]; | ^ a.cc: In function 'int main()': a.cc:127:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript 127 | REP(i, 2 * n) index[tmp[i].Y] = i; | ^
s728052547
p03799
C++
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cinttypes> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iostream> #include <limits> #include <list> #include <map> #include <memory> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int64_t N, M; cin >> N >> M; int64_t X = (M - 2 * N) / 4; int64_t result = 0; for (int64_t x = max(0LL, X - 10); x <= X + 10; ++x) { result = max(result, min(2 * (N + x), M - 2 * x)); } cout << result / 2 << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:37:23: error: no matching function for call to 'max(long long int, int64_t)' 37 | for (int64_t x = max(0LL, X - 10); x <= X + 10; ++x) { | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:37:23: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 37 | for (int64_t x = max(0LL, X - 10); x <= X + 10; ++x) { | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:37:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 37 | for (int64_t x = max(0LL, X - 10); x <= X + 10; ++x) { | ~~~^~~~~~~~~~~~~
s957791189
p03799
C++
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); long long n, m; cin >> n >> m; long long res; if (2 * n > m) res = m / 2; else res = n + (m - 2 * n) / 4; cout << res << "\n"; return 0; }98
a.cc:14:2: error: expected unqualified-id before numeric constant 14 | }98 | ^~
s493386196
p03799
C++
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m; cin >> n >> m; cout << max(n + (m - n * 2) / 4, m / 2)); }
a.cc: In function 'int main()': a.cc:7:44: error: expected ';' before ')' token 7 | cout << max(n + (m - n * 2) / 4, m / 2)); | ^ | ;
s886614620
p03799
C++
S, C = map(int, raw_input().split(' ')) X = min(S, C / 2) res = X C -= 2 * X res += C / 4 print res
a.cc:1:1: error: 'S' does not name a type 1 | S, C = map(int, raw_input().split(' ')) | ^
s913183318
p03799
C++
include<iostream> using namespace std; int main() { int n,m,k; cin>>n>>m; if(n*2<=m){ k=n; m=m-n*2; k+=m/4;} else{cout<<m/2;} cout<<"\n"<<k; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:6:1: error: 'cin' was not declared in this scope 6 | cin>>n>>m; | ^~~ a.cc:11:6: error: 'cout' was not declared in this scope 11 | else{cout<<m/2;} | ^~~~ a.cc:12:1: error: 'cout' was not declared in this scope 12 | cout<<"\n"<<k; | ^~~~
s942556752
p03799
C++
#include <iostream> using namespace std; int main(){ long long int N, M; cin >> N >> M; cout << min(N, M/2) + max(0,(M-2*N)/4) << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:28: error: no matching function for call to 'max(int, long long int)' 6 | cout << min(N, M/2) + max(0,(M-2*N)/4) << endl; | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:6:28: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 6 | cout << min(N, M/2) + max(0,(M-2*N)/4) << endl; | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
s314009657
p03799
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int result = 0; if (M >= 2) { if (N*2 <= M) { if (M - N*2) >= 4 { result = ((M - N*2) / 4) + N); } else { result = N; } } else { result = M/2; } } else { result = 0; } System.out.println(result); } }
Main.java:10: error: illegal start of expression if (M - N*2) >= 4 { ^ Main.java:10: error: ';' expected if (M - N*2) >= 4 { ^ Main.java:11: error: ';' expected result = ((M - N*2) / 4) + N); ^ Main.java:12: error: 'else' without 'if' } else { ^ 4 errors
s797871497
p03799
C++
#include <iostream> #include <vector> using namespace std; struct ioi { int x,i,type; ioi(){} ioi(int a,int b,int c){x=a,i=b,type=c;} }p[20010]; int n,x[10010],y[10010],bin[20010],last[10010],counter[20010],sz,in_st[20010],co,order[200010],al[200010],st[200010],top; vector<int> a[200010],b[200010]; void find_max(int p,int l,int r) { sz=max(sz,p); if (l==r) { in_st[l]=p; return; } find_max(p*2,l,(l+r)/2); find_max(p*2+1,(l+r)/2+1,r); } void build(int p,int l,int r) { if (l==r) { a[p].push_back(sz+counter[l]); //cout << p << " " << sz+counter[l] << "\n"; return; } build(p*2,l,(l+r)/2); build(p*2+1,(l+r)/2+1,r); a[p].push_back(p*2); a[p].push_back(p*2+1); //cout << p << " " << p*2 << "\n"; //cout << p << " " << p*2+1 << "\n"; } void add_edge(int p,int l,int r,int u,int A,int B) { if (r<A or l>B) return; if (l>=A and r<=B) { a[u].push_back(p); //cout << u << " " << p << "\n"; //if (u==15) cout << l << " " << r << " "; return; } add_edge(p*2,l,(l+r)/2,u,A,B); add_edge(p*2+1,(l+r)/2+1,r,u,A,B); } void dfs(int u) { al[u]=1; for (int i=0;i<a[u].size();i++) if (!al[a[u][i]]) dfs(a[u][i]); st[++top]=u; } void kora(int u,int root) { //cout << u << " "; al[u]=root; for (int i=0;i<b[u].size();i++) if (!al[b[u][i]]) kora(b[u][i],root); } void korasaju() { co=top=0; for (int i=1;i<=sz+2*n;i++) al[i]=0; for (int i=1;i<=sz+2*n;i++) if (!al[i]) dfs(i); for (int i=1;i<=sz+2*n;i++) al[i]=0; for (int i=1;i<=sz+2*n;i++) b[i].clear(); for (int i=1;i<=sz+2*n;i++) for (int j=0;j<a[i].size();j++) b[a[i][j]].push_back(i); while (top) { if (!al[st[top]]) kora(st[top],st[top]); top--; } } bool check(int dis) { dis--; for (int i=1;i<=sz+2*n;i++) a[i].clear(); build(1,1,2*n); for (int i=1;i<=2*n;i++) { int L=lower_bound(bin+1,bin+2*n+1,bin[i]-dis)-bin,R=(upper_bound(bin+1,bin+2*n+1,bin[i]+dis)-bin)-1; //cout << i << " " << L << " " << R << "\n"; if (i-1>=L) add_edge(1,1,2*n,i+sz,L,i-1); if (i+1<=R) add_edge(1,1,2*n,i+sz,i+1,R); } korasaju(); for (int i=1;i<=2*n;i++) if (al[i+sz]==al[counter[i]+sz]) return false; return true; } int main() { //freopen("input.txt","r",stdin); cin >> n; for (int i=1;i<=n;i++) { cin >> x[i] >> y[i]; p[i]=ioi(x[i],i,0); p[i+n]=ioi(y[i],i,1); } sort(p+1,p+2*n+1,[](ioi a,ioi b){ return (a.x<b.x); }); for (int i=1;i<=2*n;i++) { bin[i]=p[i].x; if (last[p[i].i]) counter[i]=last[p[i].i],counter[last[p[i].i]]=i; else last[p[i].i]=i; } find_max(1,1,2*n); int l=0,r=1e9+10,res=0; //cout << check(4); while (l<=r) { int m=(l+r)/2; if (check(m)) res=m,l=m+1; else r=m-1; } cout << res; }
a.cc: In function 'bool check(int)': a.cc:104:70: error: 'upper_bound' was not declared in this scope 104 | int L=lower_bound(bin+1,bin+2*n+1,bin[i]-dis)-bin,R=(upper_bound(bin+1,bin+2*n+1,bin[i]+dis)-bin)-1; | ^~~~~~~~~~~ a.cc: In function 'int main()': a.cc:125:9: error: 'sort' was not declared in this scope; did you mean 'short'? 125 | sort(p+1,p+2*n+1,[](ioi a,ioi b){ | ^~~~ | short
s836677633
p03799
C++
#include "template.hpp" int main() { int n, m; cin >> n >> m; cout << min(m / 2, (2 * n + m) / 4) << endl; }
a.cc:1:10: fatal error: template.hpp: No such file or directory 1 | #include "template.hpp" | ^~~~~~~~~~~~~~ compilation terminated.
s942225258
p03799
C++
#include<cstdio> #include<cstring> #include<algorithm> typedef __int64 ll; using namespace std; int main() { ll n, m, ans; while(scanf("%I64d %I64d", &m, &n) != EOF) { if(m * 2 >= n) { ans = n / 2; } else { n -= m * 2; ans = m + n /3; } printf("%I64d\n", ans); } return 0; }
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | typedef __int64 ll; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:8:5: error: 'll' was not declared in this scope 8 | ll n, m, ans; | ^~ a.cc:9:33: error: 'm' was not declared in this scope 9 | while(scanf("%I64d %I64d", &m, &n) != EOF) { | ^ a.cc:9:37: error: 'n' was not declared in this scope 9 | while(scanf("%I64d %I64d", &m, &n) != EOF) { | ^ a.cc:11:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | ans = n / 2; | ^~~ | abs a.cc:14:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | ans = m + n /3; | ^~~ | abs a.cc:16:27: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | printf("%I64d\n", ans); | ^~~ | abs
s316286679
p03799
C++
// ConsoleApplication50.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" #include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int us = n * 2 <= m ? n : m / 2; //cout << "us : " << us << endl; int rc = m - 2 * us; int uco = rc <= 0 ? 0 : rc / 4; cout << us + uco << endl; return 0; }
a.cc:4:10: fatal error: stdafx.h: No such file or directory 4 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s133975309
p03799
C++
#include<iostream> using namespace std; int main(){ longlongint s,c; cin>>s>>c; if(s>=c/2){ cout<<c/2<<endl; } if(c/2>s){ cout<<s+(c-s*2)/4<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'longlongint' was not declared in this scope 5 | longlongint s,c; | ^~~~~~~~~~~ a.cc:7:14: error: 's' was not declared in this scope 7 | cin>>s>>c; | ^ a.cc:7:17: error: 'c' was not declared in this scope 7 | cin>>s>>c; | ^
s052342111
p03799
C
#include<stdio.h> int main() { int s,c; int q,w; int e,r; scanf_s("%d",&s); scanf_s("%d",&c); q=s*2; if(c>q) { w=c-q; e=w/4; r=e+s; printf("%d",r); } if(c==q) { printf("%d",s); } if(c<q) { if(0==c%2) { w=c/2; printf("%d",w); } if(0!=c%2) { c--; w=c/2; printf("%d",w); } } }
main.c: In function 'main': main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 7 | scanf_s("%d",&s); | ^~~~~~~ | scanf
s848279326
p03799
C++
#include<stdio.h> int main() { __int64 N, M; scanf("%I64d %I64d", &N, &M); printf("%I64d", N + (M - 2 * N) / 4); return 0; }
a.cc: In function 'int main()': a.cc:5:4: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 5 | __int64 N, M; | ^~~~~~~ | __int64_t a.cc:6:26: error: 'N' was not declared in this scope 6 | scanf("%I64d %I64d", &N, &M); | ^ a.cc:6:30: error: 'M' was not declared in this scope 6 | scanf("%I64d %I64d", &N, &M); | ^
s556159757
p03799
C
#include<stdio.h> int main() { __int64 N, M; scanf("%I64d %I64d", &N, &M); printf("%I64d", N + (M - 2 * N) / 4); return 0; }
main.c: In function 'main': main.c:5:4: error: unknown type name '__int64'; did you mean '__int64_t'? 5 | __int64 N, M; | ^~~~~~~ | __int64_t
s898528157
p03799
C
#include "stdafx.h" #include<stdio.h> #include<stdlib.h> int main() { __int64 N, M; scanf("%I64d %I64d", &N, &M); printf("%I64d", N + (M - 2 * N) / 4); system("pause"); return 0; }
main.c:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s083221381
p03799
Java
import java.io.*; import java.util.*; import java.lang.Math.*; public class Main { private static MyScanner scanner; public static void main (String[] args){ Main instance = new Main(); scanner = instance.new MyScanner(); instance.solve(); } private void solve() { try { Long counter = 0; Long N = scanner.nextLong(); Long M = scanner.nextLong(); Long amari; if (M > 2*N) { counter += N; M -= 2*N; } else { counter += M / 2; M -= (M / 2) * 2; } if (M > 3) { counter += M / 4; } System.out.println(counter); } catch (Exception e) { e.printStackTrace(); } } private class MyScanner { String[] s; int i; BufferedReader br; String reg = " "; MyScanner () { s = new String[0]; i = 0; br = new BufferedReader(new InputStreamReader(System.in)); } public String next() throws IOException { if (i < s.length) return s[i++]; String line = br.readLine(); while (line.equals("")) { line = br.readLine(); } s = line.split(reg, 0); i = 0; return s[i++]; } public int nextInt() throws NumberFormatException, IOException { return Integer.parseInt(next()); } public double nextDouble() throws NumberFormatException, IOException { return Double.parseDouble(next()); } public long nextLong() throws NumberFormatException, IOException { return Long.parseLong(next()); } } }
Main.java:15: error: incompatible types: int cannot be converted to Long Long counter = 0; ^ 1 error
s571094509
p03799
C++
#include <iostream> int main() { int N, M; std::cin >> N >> M; int result; result = N < M / 2 ? (N + (M - 2N) / 4) : M / 2; std::cout << result << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:7:34: error: unable to find numeric literal operator 'operator""N' 7 | result = N < M / 2 ? (N + (M - 2N) / 4) : M / 2; | ^~
s824161341
p03799
C++
#include <iostream> int main() { int N, M; std::cin >> N >> M; int result = N < M / 2 ? (N + (M - 2N) / 4) : M / 2; std::cout << result << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:6:38: error: unable to find numeric literal operator 'operator""N' 6 | int result = N < M / 2 ? (N + (M - 2N) / 4) : M / 2; | ^~
s554868640
p03799
C++
def main(): arg = raw_input().split(" ") N = int(arg[0]) M = int(arg[1]) c_pattern = (M/2) if N < 1 or N > 10**12: return 0 if M < 1 or M > 10**12: return 0 if N == c_pattern: return N elif N < c_pattern: tmp = M - (N * 2) return N + (tmp / 4) elif N > c_pattern: return int(c_pattern) print main()
a.cc:2:1: error: 'def' does not name a type 2 | def main(): | ^~~
s070426925
p03799
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int64_t s, c; cin >> s >> c; int64_t k = min(s, c / 2LL); c -= k * 2LL; k += c / 4LL; cout << k << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:20: error: no matching function for call to 'min(int64_t&, long long int)' 9 | int64_t k = min(s, c / 2LL); | ~~~^~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:9:20: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int') 9 | int64_t k = min(s, c / 2LL); | ~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:9:20: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 9 | int64_t k = min(s, c / 2LL); | ~~~^~~~~~~~~~~~
s648711048
p03799
C++
#include<stdio.h> #include<math.h> int main(){ __int64 a,b; while(scanf("%I64d %I64d",&a,&b)==2) { __int64 sum=0; if(b/2>a) { sum+=a; b-=2*a; sum+=b/4; printf("%I64d\n",sum); } else { sum+=b/2; printf("%I64d\n",sum); } } return 0; }
a.cc: In function 'int main()': a.cc:4:9: error: '__int64' was not declared in this scope; did you mean '__ynf64'? 4 | __int64 a,b; | ^~~~~~~ | __ynf64 a.cc:5:36: error: 'a' was not declared in this scope 5 | while(scanf("%I64d %I64d",&a,&b)==2) | ^ a.cc:5:39: error: 'b' was not declared in this scope 5 | while(scanf("%I64d %I64d",&a,&b)==2) | ^ a.cc:7:24: error: expected ';' before 'sum' 7 | __int64 sum=0; | ^~~~ | ; a.cc:10:25: error: 'sum' was not declared in this scope 10 | sum+=a; | ^~~ a.cc:17:25: error: 'sum' was not declared in this scope 17 | sum+=b/2; | ^~~
s650437494
p03799
C
#include<stdio.h> #include<math.h> __int64 a,b; int main(){ while(scanf("%I64d %I64d",&a,&b)==2) { __int64 sum=0; if(b/2>a) { sum+=a; b-=2*a; sum+=b/4; printf("%I64d\n",sum); } else { sum+=b/2; printf("%I64d\n",sum); } } return 0; }
main.c:3:1: error: unknown type name '__int64'; did you mean '__int64_t'? 3 | __int64 a,b; | ^~~~~~~ | __int64_t main.c: In function 'main': main.c:7:17: error: unknown type name '__int64'; did you mean '__int64_t'? 7 | __int64 sum=0; | ^~~~~~~ | __int64_t
s886959692
p03799
C++
#include<cstdio> #include<iostream> #include<cstring> __int64 a,b; int main(){ while(scanf("%I64d %I64d",&a,&b)==2) { __int64 sum=0; if(b/2>a) { sum+=a; b-=2*a; sum+=b/4; printf("%I64d\n",sum); } else { sum+=b/2; printf("%d\n",sum); } } return 0; }
a.cc:4:1: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | __int64 a,b; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:6:36: error: 'a' was not declared in this scope 6 | while(scanf("%I64d %I64d",&a,&b)==2) | ^ a.cc:6:39: error: 'b' was not declared in this scope 6 | while(scanf("%I64d %I64d",&a,&b)==2) | ^ a.cc:8:17: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 8 | __int64 sum=0; | ^~~~~~~ | __int64_t a.cc:11:25: error: 'sum' was not declared in this scope 11 | sum+=a; | ^~~ a.cc:18:25: error: 'sum' was not declared in this scope 18 | sum+=b/2; | ^~~
s035164256
p03799
C++
#include<cstdio> #include<iostream> #include<cstring> __int64 a,b; int main(){ while(scanf("%I64d %I64d",&a,&b)==2) { __int64 sum=0; if(b/2>a) { sum+=a; b-=2*a; sum+=b/4; printf("%I64d\n",sum); } else { sum+=b/2; printf("%d\n",sum); } } return 0; }
a.cc:4:1: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | __int64 a,b; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:6:36: error: 'a' was not declared in this scope 6 | while(scanf("%I64d %I64d",&a,&b)==2) | ^ a.cc:6:39: error: 'b' was not declared in this scope 6 | while(scanf("%I64d %I64d",&a,&b)==2) | ^ a.cc:8:17: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 8 | __int64 sum=0; | ^~~~~~~ | __int64_t a.cc:11:25: error: 'sum' was not declared in this scope 11 | sum+=a; | ^~~ a.cc:18:25: error: 'sum' was not declared in this scope 18 | sum+=b/2; | ^~~
s815965437
p03799
C++
#include <iostream> #include <string> #include <vector> #include <map> #include <set> #include <sstream> #include <algorithm> using namespace std; #define numberof(a) (sizeof(a) / sizeof(a[0])) #define INF (1000000) #define Rep(i,n) for(int i = 0; i < (n); i++ ) //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) //debug #define dump(x) cout << #x << " = " << (x) << endl; #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #define show(x) copy( (x).begin(), (x).end(), ostream_iterator<int>(cout, ",") ); // container<int>を全て表示 typedef long long ll; //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); int main() { ll N, M = 0; ll ans = 0; cin >> N >> M; if( N <= 2 * M ){ ans = N; M -= 2 * N; } ans += M / 4; cout << ans << endl; return 0; }
a.cc:28:19: error: 'acos' was not declared in this scope 28 | const double PI = acos(-1.0); | ^~~~
s936977113
p03799
C++
#include <iostream> #include <string> #include <vector> #include <map> #include <set> #include <sstream> #include <algorithm> using namespace std; #define numberof(a) (sizeof(a) / sizeof(a[0])) #define INF (1000000) #define Rep(i,n) for(int i = 0; i < (n); i++ ) //clear memory #define CLR(a) memset((a), 0 ,sizeof(a)) //debug #define dump(x) cout << #x << " = " << (x) << endl; #define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #define show(x) copy( (x).begin(), (x).end(), ostream_iterator<int>(cout, ",") ); // container<int>を全て表示 typedef long long ll; //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); int main() { ll N, M = 0; ll ans = 0; cin >> N >> M; if( N <= 2 * M ){ ans = N; M -= 2 * N; } ans += M / 4; cout << ans << endl; return 0; }
a.cc:28:19: error: 'acos' was not declared in this scope 28 | const double PI = acos(-1.0); | ^~~~
s019154145
p03799
C++
#include <string.h> #include <string> #include <vector> #include <deque> #include <list> #include <stack> #include <queue> #include <map> #include <set> #include <iterator> #include <functional> #include <algorithm> #include <numeric> #include <iostream> #include <sstream> #include <iomanip> #include <cmath> #include <cstdlib> #include <cstdio> using namespace std; #define sz(a) int((a).size()) #define all(a) a.begin(), a.end() #define pb push_back #define mp make_pair #define CLR(a) memset((a), 0, sizeof(a)) #define INF (1 << 31) - 1 const int dh[8] = {-1, 1, 0, 0,1,1,-1,-1}; const int dw[8] = {0, 0, 1, -1,1,-1,1,-1}; typedef long long ll; typedef pair<int, int> p; typedef vector <int> VI; typedef vector <string> VS; vector <int> his; int main(){ ll s,c; cin >> s; cin >> c; if(c <= 2 * s ){ cout << c / 2 << endl; }else{ cout << s + ((c - 2 * s) / 4 << endl; } return 0; }
a.cc: In function 'int main()': a.cc:45:46: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator<<' 45 | cout << s + ((c - 2 * s) / 4 << endl; | ~~~~~~~~~~~~~~~~^~~~~~~ a.cc:45:53: error: expected ')' before ';' token 45 | cout << s + ((c - 2 * s) / 4 << endl; | ~ ^ | )
s072796243
p03799
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; int ans; scanf("%d%d", &n,&m); if(n*2 > m) ans = m/2; else ans = n+(m-n*2)/4; printf("%d\n", ans); }
a.cc:4:11: error: expected initializer before '\U0000ff5b' 4 | int main(){ | ^~ a.cc:7:11: error: expected constructor, destructor, or type conversion before '(' token 7 | scanf("%d%d", &n,&m); | ^ a.cc:8:6: error: expected unqualified-id before 'if' 8 | if(n*2 > m) ans = m/2; | ^~ a.cc:9:6: error: expected unqualified-id before 'else' 9 | else ans = n+(m-n*2)/4; | ^~~~ a.cc:10:12: error: expected constructor, destructor, or type conversion before '(' token 10 | printf("%d\n", ans); | ^ a.cc:11:1: error: '\U0000ff5d' does not name a type 11 | } | ^~
s714146752
p03799
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; int ans; scanf("%d%d", &n,&m); if(n*2 > m) ans = m/2; else ans = n+ (m-n*2)/4; printf("%d\n", ans); }
a.cc:4:11: error: expected initializer before '\U0000ff5b' 4 | int main(){ | ^~ a.cc:7:11: error: expected constructor, destructor, or type conversion before '(' token 7 | scanf("%d%d", &n,&m); | ^ a.cc:8:6: error: expected unqualified-id before 'if' 8 | if(n*2 > m) ans = m/2; | ^~ a.cc:9:6: error: expected unqualified-id before 'else' 9 | else ans = n+ (m-n*2)/4; | ^~~~ a.cc:10:12: error: expected constructor, destructor, or type conversion before '(' token 10 | printf("%d\n", ans); | ^ a.cc:11:1: error: '\U0000ff5d' does not name a type 11 | } | ^~
s363952652
p03799
C
include<stdio.h> int main(void) { //3つの狼の合計が偶数->〇 //S->0 W->1 //S->0x53 //W->0x57 //o->0x6f //x->0x78 long long int N, i, h, x = 0, ok = 0; char c; static char say[100015]; static long long int dou[100015]; long long int sta[2]; scanf("%lld", &N); fflush(stdin); for (i = 0; i < N; i++) { scanf("%c", &say[i]); } for (h = 0; h < 4; h++) { if (h == 0) { sta[0] = 0; sta[1] = 0; } if (h == 1) { sta[0] = 0; sta[1] = 1; } if (h == 2) { sta[0] = 1; sta[1] = 0; } if (h == 3) { sta[0] = 1; sta[1] = 1; } dou[0] = sta[0]; dou[1] = sta[1]; for (i = 2; i < N + 2; i++) { if (say[i-1] == 0x6f) { x = 0; }else { x = 1; } if ((x+dou[i - 1] + dou[i - 2])%2==1) {dou[i] = 1;}else { dou[i] = 0;} } if (dou[N] == sta[0] && dou[N + 1] == sta[1]) { for (i = 0; i < N; i++) { if (dou[i] == 0) { c = 0x53; } else { c = 0x57; } printf("%c", c); ok = 1; } break; } } if (ok == 0) { printf("-1"); } printf("\n"); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^
s065613037
p03799
C++
#!/usr/bin/python3 # Copyright (C) 2017 Sayutin Dmitry. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; version 3 # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; If not, see <http://www.gnu.org/licenses/>. def main(): s, c = map(int, input().split()) lo, hi = 0, int(1e18) while hi - lo > 1: mi = lo + (hi - lo) // 2 free = c - 2 * mi if free < 0 or s + free // 2 < mi: hi = mi else: lo = mi print(lo) main()
a.cc:1:2: error: invalid preprocessing directive #! 1 | #!/usr/bin/python3 | ^ a.cc:2:3: error: invalid preprocessing directive #Copyright 2 | # Copyright (C) 2017 Sayutin Dmitry. | ^~~~~~~~~ a.cc:4:3: error: invalid preprocessing directive #This 4 | # This program is free software; you can redistribute it and/or | ^~~~ a.cc:5:3: error: invalid preprocessing directive #modify 5 | # modify it under the terms of the GNU General Public License as | ^~~~~~ a.cc:6:3: error: invalid preprocessing directive #published 6 | # published by the Free Software Foundation; version 3 | ^~~~~~~~~ a.cc:8:3: error: invalid preprocessing directive #This 8 | # This program is distributed in the hope that it will be useful, | ^~~~ a.cc:9:3: error: invalid preprocessing directive #but 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ^~~ a.cc:10:3: error: invalid preprocessing directive #MERCHANTABILITY 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ^~~~~~~~~~~~~~~ a.cc:11:3: error: invalid preprocessing directive #GNU 11 | # GNU General Public License for more details. | ^~~ a.cc:13:3: error: invalid preprocessing directive #You 13 | # You should have received a copy of the GNU General Public License | ^~~ a.cc:14:3: error: invalid preprocessing directive #along 14 | # along with this program; If not, see <http://www.gnu.org/licenses/>. | ^~~~~ a.cc:16:1: error: 'def' does not name a type 16 | def main(): | ^~~
s057764850
p03799
Java
import java.util.*; public class puzzle_1 { public static int readint() { Scanner s = new Scanner(System.in); return s.nextInt(); //s.nextInt(); } public static void main(String[] args) { long N, M; long p; N = readint(); M = readint(); if(M >= (2 * N)) p = N + (M - 2*N)/4; else p = M/2; System.out.println(p); } }
Main.java:2: error: class puzzle_1 is public, should be declared in a file named puzzle_1.java public class puzzle_1 { ^ 1 error
s741869332
p03799
C++
import java.util.Scanner; /** * Created by srikanth on 18-02-2017. */ public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); int N=in.nextInt(); int M=in.nextInt(); int val=0; if(2*N<=M){ val+=N; M-=2*N; } val+=(M/4); System.out.println(val); } }
a.cc:3:1: error: 'import' does not name a type 3 | import java.util.Scanner; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: expected unqualified-id before 'public' 8 | public class Main { | ^~~~~~
s382148314
p03799
C++
import Control.Monad import Data.Maybe import qualified Data.ByteString.Char8 as C solve m n acc | m /= 0 && n >= 2 = solve (m - 1) (n - 2) (acc + 1) | n >= 4 = solve m (n - 4) (acc + 1) | otherwise = acc main = do [m, n] <- readInts -- print $ solve 1 6 0 -- print $ solve 12345 678901 0 print $ solve m n 0 where toInt :: String -> Int toInt = read readInts :: IO [Int] readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine readNInts :: Int -> IO [[Int]] readNInts = flip replicateM readInts readIntegers :: IO [Integer] readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine readNIntegers :: Int -> IO [[Integer]] readNIntegers = flip replicateM readIntegers
a.cc:1:1: error: 'import' does not name a type 1 | import Control.Monad | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s263967676
p03799
C++
#include <iostream> #include <string> #include <algorithm> #include <cstdio> using namespace std; int main() { lomg int n,m; scanf("%ld %ld", &n, &m); long int num = 0; if (m == 0) { num = 0; }else { num = n + (m - 2 * n) / 4; } printf("%ld\n", num); return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'lomg' was not declared in this scope; did you mean 'long'? 10 | lomg int n,m; | ^~~~ | long a.cc:12:27: error: 'n' was not declared in this scope 12 | scanf("%ld %ld", &n, &m); | ^ a.cc:12:31: error: 'm' was not declared in this scope; did you mean 'tm'? 12 | scanf("%ld %ld", &n, &m); | ^ | tm
s348579495
p03799
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n,m; cin>>n>>m; ll l=0; llr=n; ll ans; while(l<=r){ ll mid=(l+r)/2; ll rr=m; rr-=mid*2; ll e=n+rr/2; rr-=(rr/2); if(e>= mid && rr>=0) l=mid+1,ans=mid; else r=mid-1; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:8:1: error: 'llr' was not declared in this scope; did you mean 'll'? 8 | llr=n; | ^~~ | ll a.cc:10:10: error: 'r' was not declared in this scope 10 | while(l<=r){ | ^
s475791038
p03799
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long a,b; cin>>a>>b; ll r=a*2; ll ans=(r+b)/4; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:6:1: error: 'll' was not declared in this scope 6 | ll r=a*2; | ^~ a.cc:7:3: error: expected ';' before 'ans' 7 | ll ans=(r+b)/4; | ^~~~ | ; a.cc:8:7: error: 'ans' was not declared in this scope; did you mean 'abs'? 8 | cout<<ans<<endl; | ^~~ | abs
s755181936
p03799
C++
n,m = map(int, raw_input().split()) if 2*n < m: print n + (m-2*n)/4 elif 2*n == m: print n else: print m/2
a.cc:1:1: error: 'n' does not name a type 1 | n,m = map(int, raw_input().split()) | ^
s889506406
p03799
C++
#include<bits/stdc++.h> #include <stdio.h> using namespace std; #define mod 1000000007LL #define pi 3.141592653589793238462643383279; #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define f first #define s second #define pic pair<char,long long > void scan(vector<ll> & v) { for(int i=0;i<v.size();i++) scanf("%lld",&v[i]); } void print(vector<int> & v) { for(int i=0;i<v.size();i++) printf("%d ",v[i]); } int main()a { ll n,m; cin>>n>>m; if(n>=m/2) { cout<<m/2<<endl; } else { cout<<n+(m-2*n)/4<<endl; } ll acc;cin>>acc; return 0; }
a.cc:28:11: error: expected initializer before 'a' 28 | int main()a | ^
s290211758
p03799
C++
#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; using i32 = int32_t; using i64 = int64_t; using f64 = double_t; using str = string; template <typename T> using vec = vector<T>; template <typename T> using heap = priority_queue<T, vec<T>, greater<T>>; #define times(n, i) for (i32 i = 0; i < (n); ++i) #define range(a, b, i) for (i32 i = (a); i < (b); ++i) #define upto(a, b, i) for (i32 i = (a); i <= (b); ++i) #define downto(a, b, i) for (i32 i = (a); i >= (b); --i) #define stepup(a, b, s, i) for (i32 i = (a); i <= (b); i+=(s)) #define stepdown(a, b, s, i) for (i32 i = (a); i >= (b); i-=(s)) #define foreach(xs, x) for (auto &x : (xs)) #define all(xs) (xs).begin(), (xs).end() #define sortall(xs) sort(all(xs)) #define reverseall(xs) reverse(all(xs)) #define uniqueall(xs) (xs).erase(unique(all(xs)), (xs).end()) #define maximum(xs) (*max_element(all(xs))) #define minimum(xs) (*min_element(all(xs))) #define even(x) (((x) & 1) == 0) #define odd(x) (((x) & 1) == 1) #define append emplace_back const i64 MOD = 1000000007; i64 n,m; i32 main() { cin >> n >> m; i64 ans = min(n, m/2); ans += max(0LL, (m - ans*2)/4); cout << ans << endl; return 0; }
a.cc: In function 'i32 main()': a.cc:33:15: error: no matching function for call to 'max(long long int, i64)' 33 | ans += max(0LL, (m - ans*2)/4); | ~~~^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:4: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:33:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'i64' {aka 'long int'}) 33 | ans += max(0LL, (m - ans*2)/4); | ~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:33:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | ans += max(0LL, (m - ans*2)/4); | ~~~^~~~~~~~~~~~~~~~~~~~
s755021228
p03800
C++
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using namespace std; #define all(v) v.begin(), v.end() using in = int64_t; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define Yes cout<<"Yes"<<endl #define No cout<<"No"<<endl #define yes cout<<"yes"<<endl #define no cout<<"no"<<endl #define YES cout<<"YES"<<endl #define NO cout<<"NO"<<endl const in MOD = 1000000007; const in INF=1e18+7; const int inf=1e9+7; using P=pair<int,int>; using T=tuple<int,int,int>; vector<int> dx={0,1,-1,0}; vector<int> dy={1,0,0,-1}; template <typename Typ> bool chmin(Typ &a, const Typ& b) {if (a > b) {a = b; return true;} return false;} template <typename Typ> bool chmax(Typ &a, const Typ& b) {if (a < b) {a = b; return true;} return false;} string s; int n; bool check(vector<bool> x){ bool ret =true; if(x[0]){ if(s[0]=='o' && x[1]!=x[n-1]) ret =false; if(s[0]=='x' && x[1]==x[n-1]) ret =false; } else{ if(s[0]=='x' && x[1]!=x[n-1]) ret =false; if(s[0]=='o' && x[1]==x[n-1]) ret =false; } if(x[n-1]){ if(s[n-1]=='o' && x[0]!=x[n-2]) ret =false; if(s[n-1]=='x' && x[0]==x[n-2]) ret =false; } else{ if(s[n-1]=='x' && x[0]!=x[n-2]) ret =false; if(s[n-1]=='o' && x[0]==x[n-2]) ret =false; } return ret; } int main(){ ios::sync_with_stdio(false);cin.tie(nullptr); //cout << fixed << setprecision(10); cin>>n>>s; bool ok=false; //ww vector<bool> ww(n,false);//w:false REP(i,1,n-1){ if(s[i]=='o') ww[i+1]=ww[i-1]; else ww[i+1]=(!ww[i-1]); if(!ww[i]) ww[i+1] =(!ww[i+1]); } ok=check(ww); if(ok){ rep(i,n){ cout<<(ww[i]?'S':'W'); } cout<<endl; return 0; } //ws vector<bool> ws(n,false);//w:false ws[1]=true; REP(i,1,n-1){ if(s[i]=='o') ws[i+1]=ws[i-1]; else ws[i+1]=(!ws[i-1]); if(!ws[i]) ws[i+1] =(!ws[i+1]); } ok=check(ws); if(ok){ rep(i,n){ cout<<(ws[i]?'S':'W'); } cout<<endl; return 0; } //sw vector<bool> sw(n,false);//w:false sw[0]=true; REP(i,1,n-1){ if(s[i]=='o') sw[i+1]=sw[i-1]; else sw[i+1]=(!sw[i-1]); if(!sw[i]) sw[i+1] =(!sw[i+1]); } ok=check(sw); if(ok){ rep(i,n){ cout<<(sw[i]?'S':'W'); } cout<<endl; return 0; } //ss vector<bool> ss(n,true);//w:false REP(i,1,n-1){ if(s[i]=='o') ss[i+1]=ss[i-1]; else ss[i+1]=(!ss[i-1]); if(!ss[i]) ss[i+1] =(!ss[i+1]); } ok=check(ss); if(ok){ rep(i,n){ cout<<(ss[i]?'S':'W'); } cout<<endl; return 0; } //ダメだった cout<<-1<<endl; }/* ./problem.exe */
a.cc:3:10: fatal error: atcoder/all: No such file or directory 3 | #include <atcoder/all> | ^~~~~~~~~~~~~ compilation terminated.
s762681199
p03800
C++
/** * * Author : MeGa * */ #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> #include <unordered_map> #include <unordered_set> #include <string.h> using namespace std; string s; // O 1 // X 0 #define S 0 #define W 1 bool solve(vector<pair<int,int> >&v){ while(v.size() < s.size()){ int prev = v[v.size()-2].second; if(s[v.back().first] == 'x' ){ if(v.back().second == S) v.push_back(make_pair((v.back().first+1)%s.size(),1-prev)); else v.push_back(make_pair((v.back().first+1)%s.size(),prev)); }else{ if(v.back().second == S) v.push_back(make_pair((v.back().first+1)%s.size(),prev)); else v.push_back(make_pair((v.back().first+1)%s.size(),1-prev)); } } vector<char>ans(v.size(),-1); for(int i = 0; i < v.size();i++){ ans[v[i].first] = (v[i].second)? 'W' : 'S'; } // validate for(int i = 0; i < ans.size(); i ++){ int idx = i; char prevSign = ans[(idx-1+ans.size())%ans.size()]; char nextSign = ans[(idx+1)%ans.size()]; if(ans[idx] == 'S'){ if(s[idx] == 'o'){ if(prevSign != nextSign) return false; }else{ if(prevSign == nextSign) return false; } }else{ if(s[idx] == 'x'){ if(prevSign != nextSign) return false; }else{ if(prevSign == nextSign) return false; } } } return true; } int main(){ #ifndef ONLINE_JUDGE //freopen("in","r",stdin); #endif ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; cin>>s; if(s[0] == 'x'){ int left = s.size()-1; int cur = 0 ; int right = 1; // generate all possible 3 starts for(int ii = 0 ; ii <= 1; ii++){ for(int j = 0 ; j <= 1; j++){ for(int k = 0; k <= 1 ; k++){ vector<pair<int,int> >v; v.push_back(make_pair(left,j)); v.push_back(make_pair(cur,ii)); v.push_back(make_pair(right,k)); if(solve(v)){ found = true; vector<char>ans(s.size(),0); for(int i = 0; i < v.size();i ++){ ans[v[i].first] = (v[i].second ? 'W' : 'S'); } //cout<<"hola"<<endl; for(int i = 0; i < ans.size();i++){ cout<<ans[i]; } return 0; } } } } bool isAllO = true; for(char c : s){ if(c == 'x'){ isAllO = false; } } if(isAllO){ for(int i = 0 ; i < s.size();i++){ cout<<"S"; } }else{ cout<<-1<<endl; } }
a.cc: In function 'int main()': a.cc:132:37: error: 'found' was not declared in this scope; did you mean 'round'? 132 | found = true; | ^~~~~ | round a.cc:170:2: error: expected '}' at end of input 170 | } | ^ a.cc:102:11: note: to match this '{' 102 | int main(){ | ^
s642806171
p03800
C++
#include<bits/stdc++.h> using namespace std; int n,a[1<<17],b,c,i; string s; int main(){ cin>>n>>s; for(b:{0,1}){ for(c:{0,1}){ a[1]=b; a[2]=c; a[0]=(s[1]=='o')^b^c; for(i=3;i<n;i++)a[i]=(s[i-1]=='o')^a[i-1]^a[i-2]; if((s[n-1]=='o')^a[n-1]==a[0]^a[n-2]&&(s[0]=='o')^a[0]==a[n-1]^a[1]){ for(i=0;i<n;i++)cout<<(a[i]==1?'S':'W'); cout<<endl; return 0; } } } cout<<-1<<endl; }
a.cc: In function 'int main()': a.cc:7:8: error: expected ';' before ':' token 7 | for(b:{0,1}){ | ^ | ; a.cc:7:14: error: expected primary-expression before ')' token 7 | for(b:{0,1}){ | ^ a.cc:7:14: error: expected ';' before ')' token 7 | for(b:{0,1}){ | ^ | ; a.cc:8:10: error: expected ';' before ':' token 8 | for(c:{0,1}){ | ^ | ; a.cc:8:16: error: expected primary-expression before ')' token 8 | for(c:{0,1}){ | ^ a.cc:8:16: error: expected ';' before ')' token 8 | for(c:{0,1}){ | ^ | ;
s402455034
p03800
C++
#include <iostream> using namespace std; int main() { int N; cin >> N; string s; cin >> s; string ans(N, 'S'); for (int i = 1; i < N - 1; i++) { if (ans[i] == 'S' && ans[i - 1] == 'S' && s[i] == 'x') ans[i + 1] = 'W'; if (ans[i] == 'S' && ans[i - 1] == 'W' && s[i] == 'o') ans[i + 1] = 'W'; if (ans[i] == 'W' && ans[i - 1] == 'S' && s[i] == 'o') ans[i + 1] = 'W'; if (ans[i] == 'W' && ans[i - 1] == 'W' && s[i] == 'x') ans[i + 1] = 'W'; } bool OK = true; if (ans[N - 1] == 'S' && s[N - 1] == 'o' && ans[N - 2] != ans[0]) OK = false; if (ans[N - 1] == 'S' && s[N - 1] == 'x' && ans[N - 2] == ans[0]) OK = false; if (ans[N - 1] == 'W' && s[N - 1] == 'o' && ans[N - 2] == ans[0]) OK = false; if (ans[N - 1] == 'W' && s[N - 1] == 'x' && ans[N - 2] != ans[0]) OK = false; if (s[0] == 'o' && ans[N - 1] == 'W') OK = false; if (s[0] == 'x' && ans[N - 1] == 'S') OK = false; if (OK) { cout << ans << endl; return 0; } if (s[0] == 'x') ans[1] = 'W'; for (int i = 1; i < N - 1; i++) { if (ans[i] == 'S' && ans[i - 1] == 'S' && s[i] == 'x') ans[i + 1] = 'W'; if (ans[i] == 'S' && ans[i - 1] == 'W' && s[i] == 'o') ans[i + 1] = 'W'; if (ans[i] == 'W' && ans[i - 1] == 'S' && s[i] == 'o') ans[i + 1] = 'W'; if (ans[i] == 'W' && ans[i - 1] == 'W' && s[i] == 'x') ans[i + 1] = 'W'; } bool OK = true; if (ans[N - 1] == 'S' && s[N - 1] == 'o' && ans[N - 2] != ans[0]) OK = false; if (ans[N - 1] == 'S' && s[N - 1] == 'x' && ans[N - 2] == ans[0]) OK = false; if (ans[N - 1] == 'W' && s[N - 1] == 'o' && ans[N - 2] == ans[0]) OK = false; if (ans[N - 1] == 'W' && s[N - 1] == 'x' && ans[N - 2] != ans[0]) OK = false; if (s[0] == 'o' && ans[N - 1] == 'W') OK = false; if (s[0] == 'x' && ans[N - 1] == 'S') OK = false; if (OK) cout << ans << endl; else cout << -1 << endl; }
a.cc: In function 'int main()': a.cc:34:14: error: redeclaration of 'bool OK' 34 | bool OK = true; | ^~ a.cc:16:14: note: 'bool OK' previously declared here 16 | bool OK = true; | ^~
s066897705
p03800
C++
#include <iostream> //#include <iomanip> #include <string> //#include <vector> #include <algorithm> //#include <utility> //#include <set> //#include <map> //#include <queue> //#include <deque> //#include <bitset> //#include <math.h> using namespace std ; using ll = long long ; //using ld = long double ; //using vll = vector<ll> ; //using vvll = vector<vll> ; //using vc = vector<char> ; //using vvc = vector<vc> ; //using vb = vector<bool> ; //using vvb = vector<vb> ; //using pll = pair<ll,ll> ; //#define all(v) v.begin(),v.end() //ll mod = 1e9+7 ; //long double pie = acos(-1) ; //ll INF = 1000000000000 ; //void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;} //void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;} //ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;} //ll lcm(long long a,long long b){return a/gcd(a,b)*b ;} //ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;} //void fix_cout(){cout << fixed << setprecision(20) ;} ll n ; string str ; bool DFS(string &s,char c){ s += c ; ll sz = s.size() ; // cout << s << " " << sz << endl ; if(sz<=2){ if(DFS(s,'S')) return true ; else if(DFS(s,'W')) return true ; else{ s.pop_back() ; return false ; } } ll p = (sz==n+2?0:sz-2) ; if(s.at(p)=='S'){ if(str.at(p)=='o'&&s.at(sz-3)!=s.at(sz-1)){ s.pop_back() ; return false ; } if(str.at(p)=='x'&&s.at(sz-3)==s.at(sz-1)){ s.pop_back() ; return false ; } }else{ if(str.at(p)=='x'&&s.at(sz-3)!=s.at(sz-1)){ s.pop_back() ; return false ; } if(str.at(p)=='o'&&s.at(sz-3)==s.at(sz-1)){ s.pop_back() ; return false ; } } if(sz==n){ // cout << "sz==n" << endl ; if(DFS(s,s.at(0))) return true ; else{ s.pop_back() ; return false ; } } if(sz==n+1){ // cout << "sz==n+1" << endl ; if(DFS(s,s.at(1))) return true ; else{ s.pop_back() ; return false ; } } if(sz==n+2){ // cout << "sz==n+2" << endl ; s.pop_back() ; s.pop_back() ; cout << s << endl ; return true ; } if(sz<n){ // cout << "sz<n" << endl ; if(DFS(s,'S')) return true ; else if(DFS(s,'W')) return true ; else{ s.pop_back() ; return false ; } } } int main(){ cin.tie(nullptr) ; ios::sync_with_stdio(false) ; cin >> n ; cin >> str ; if(DFS(""s,'S')) return 0 ; if(DFS(""s,'W')) return 0 ; cout << -1 << endl ; }
a.cc: In function 'int main()': a.cc:110:16: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>' 110 | if(DFS(""s,'S')) return 0 ; | ^~~ a.cc:38:18: note: initializing argument 1 of 'bool DFS(std::string&, char)' 38 | bool DFS(string &s,char c){ | ~~~~~~~~^ a.cc:111:16: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>' 111 | if(DFS(""s,'W')) return 0 ; | ^~~ a.cc:38:18: note: initializing argument 1 of 'bool DFS(std::string&, char)' 38 | bool DFS(string &s,char c){ | ~~~~~~~~^ a.cc: In function 'bool DFS(std::string&, char)': a.cc:102:1: warning: control reaches end of non-void function [-Wreturn-type] 102 | } | ^
s494021973
p03800
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll N; cin >> N; string s,t; cin >> s; t.resize(N); ll i,j; t[0]='S'; t[1]='S'; for(i=0;i<4;i++){ if(i==0){t[0]='S';t[1]='S';} if(i==1){t[0]='S';t[1]='W';} if(i==2){t[0]='W';t[1]='S';} if(i==3){t[0]='W';t[1]='W';} for(j=1;j<N-1;j++){ if((t[j]=='S'&&s[j]=='o')||(t[j]=='W'&&s[j]=='x'))t[j+1]=t[j-1]; if((t[j]=='W'&&s[j]=='o')||(t[j]=='S'&&s[j]=='x'))t[j+1]=((t[j-1]=='S')?'W':'S'); } ll flag1=0,flag2=0; if((t[N-1]=='S'&&s[N-1]=='o')||(t[N-1]=='W'&&s[N-1]=='x')){ if(t[0]==t[N-2])flag1=1; } if((t[N-1]=='W'&&s[N-1]=='o')||(t[N-1]=='S'&&s[N-1]=='x')){ if(t[0]!=t[N-2])flag1=1; } if((t[0]=='S'&&s[0]=='o')||(t[0]=='W'&&s[0]=='x')){ if(t[N-1]==t[1])flag2=1; } if((t[0]=='W'&&s[0]=='o')||(t[0]=='S'&&s[0]=='x')){ if(t[N-1]!=t[1])flag2=1; } if(flag1&&flag2){cout << t << endl;return 0} } cout << -1; return 0; }
a.cc: In function 'int main()': a.cc:45:52: error: expected ';' before '}' token 45 | if(flag1&&flag2){cout << t << endl;return 0} | ^ | ;
s370971955
p03800
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll N; cin >> N; string s,t; cin >> s; t.resize(N); ll i,j; t[0]='S'; t[1]='S'; for(i=0;i<4;i++){ if(i==0){t[0]='S';t[1]='S';} if(i==1){t[0]='S';t[1]='W';} if(i==2){t[0]='W';t[1]='S';} if(i==3){t[0]='W';t[1]='W';} for(j=1;j<N-1;j++){ if((t[j]=='S'&&s[j]=='o')||(t[j]=='W'&&s[j]=='x'))t[j+1]=t[j-1]; if((t[j]=='W'&&s[j]=='o')||(t[j]=='S'&&s[j]=='x'))t[j+1]=((t[j-1]=='S')?'W':'S'); } ll flag1=0,flag2=0; if((t[N-1]=='S'&&s[N-1]=='o')||(t[N-1]=='W'&&s[N-1]=='x')){ if(t[0]==t[N-2])flag1=1: } if((t[N-1]=='W'&&s[N-1]=='o')||(t[N-1]=='S'&&s[N-1]=='x')){ if(t[0]!=t[N-2])flag1=1; } if((t[0]=='S'&&s[0]=='o')||(t[0]=='W'&&s[0]=='x')){ if(t[N-1]==t[1])flag2=1; } if((t[0]=='W'&&s[0]=='o')||(t[0]=='S'&&s[0]=='x')){ if(t[N-1]!=t[0])flag2=1; } if(flag1&&flag2){cout << t << endl;} } cout << -1; return 0; }
a.cc: In function 'int main()': a.cc:34:36: error: expected ';' before ':' token 34 | if(t[0]==t[N-2])flag1=1: | ^ | ;
s240001893
p03800
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll N; cin >> N; string s,t; cin >> s; t.resize(N); ll i,j; t[0]='S'; t[1]='S'; for(i=0;i<4;i++){ if(i==0){t[0]='S';t[1]='S';} if(i==1){t[0]='S';t[1]='W';} if(i==2){t[0]='W';t[1]='S';} if(i==3){t[0]='W';t[1]='W';} for(j=1;j<N-1;j++){ if((t[j]=='S'&&s[j]=='o')||(t[j]=='W'&&s[j]=='x'))t[j+1]=t[j-1]; if((t[j]=='W'&&s[j]=='o')||(t[j]=='S'&&s[j]=='x'))t[j+1]=((t[j-1]=='S')?'W':'S'); } ll flag1=0,flag2=0; if((t[N-1]=='S'&&s[N-1]=='o')||(t[N-1]=='W'&&s[N-1]=='x')){ if(t[0]==t[N-2])flag1=1: } if((t[N-1]=='W'&&s[N-1]=='o')||(t[N-1]=='S'&&s[N-1]=='x')){ if(t[0]!=t[N-2])flag1=1; } if((t[0]=='S'&&s[0]=='o')||(t[0]=='W'&&s[0]=='x')){ if(t[N-1]==t[1])flag2=1; } if((t[0]=='W'&&s[0]=='o')||(t[0]=='S'&&s[0]=='x')){ if(t[N-1]!=t[0])flag2=1; } if(flag1&&flag2){cout << t << endl;} } cout << -1; return 0; }
a.cc: In function 'int main()': a.cc:34:36: error: expected ';' before ':' token 34 | if(t[0]==t[N-2])flag1=1: | ^ | ;
s331280463
p03800
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll N; cin >> N; string s,t; cin >> s; t.resize(N); ll i,j; t[0]='S'; t[1]='S'; for(i=0;i<4;i++){ if(i==0){t[0]='S';t[1]='S';} if(i==1){t[0]='S';t[1]='W';} if(i==2){t[0]='W';t[1]='S';} if(i==3){t[0]='W';t[1]='W';} for(j=1;j<N-1;j++){ if((t[j]=='S'&&s[j]=='o')||(t[j]=='W'&&s[j]=='x'))t[j+1]=t[j-1]; if((t[j]=='W'&&s[j]=='o')||(t[j]=='S'&&s[j]=='x'))t[j+1]=((t[j-1]=='S')?'W':'S'); } ll flag1=0,flag2=0; if((t[N-1]=='S'&&s[N-1]=='o')||(t[N-1]=='W'&&s[N-1]=='x')){ if(t[0]==t[N-2])flag1=1: } if((t[N-1]=='W'&&s[N-1]=='o')||(t[N-1]=='S'&&s[N-1]=='x')){ if(t[0]!=t[N-2])flag1=1; } if((t[0]=='S'&&s[0]=='o')||(t[0]=='W'&&s[0]=='x')){ if(t[N-1]==t[1])flag2=1: } if((t[0]=='W'&&s[0]=='o')||(t[0]=='S'&&s[0]=='x')){ if(t[N-1]!=t[0])flag2=1; } if(flag1&&flag2){cout << t << endl} } cout << -1; return 0; }
a.cc: In function 'int main()': a.cc:34:36: error: expected ';' before ':' token 34 | if(t[0]==t[N-2])flag1=1: | ^ | ; a.cc:40:36: error: expected ';' before ':' token 40 | if(t[N-1]==t[1])flag2=1: | ^ | ; a.cc:45:43: error: expected ';' before '}' token 45 | if(flag1&&flag2){cout << t << endl} | ^ | ;
s544202055
p03800
C++
#include <stdio.h> #include <string.h> #include <limits.h> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> typedef unsigned long long ULLONG; typedef long long LLONG; static const LLONG MOD_NUM = 1000000007; template <class _T> static _T tp_abs(const _T& a) { // usage: tp_abs<type name>(a); return ((a < 0) ? (a * -1) : a); } template <class _T> static _T tp_min(_T a, _T b) { return a < b ? a : b; } template <class _T> static _T tp_max(_T a, _T b) { return a > b ? a : b; } template<class _T> static void get1int(_T& a) { const char* fmt = " %d"; if (sizeof(_T) == sizeof(long long)) { fmt = " %lld"; } if (scanf(fmt, &a) < 0) { printf("g1int Error\n"); } } template<class _T> static void get2int(_T& a, _T& b) { const char* fmt = " %d %d"; if (sizeof(_T) == sizeof(long long)) { fmt = " %lld %lld"; } if (scanf(fmt, &a, &b) < 0) { printf("g2int Error\n"); } } static void ARC069D_Menagerie(); #if 1 int main() { ARC069D_Menagerie(); fflush(stdout); return 0; } #endif static void ARC069D_Menagerie() { int N; get1int(N); auto seq = new char[N + 1]; getstring(seq); auto ans = new char[N + 1]; ans[N] = 0; const char* first = "SSWW"; const char* second = "SWSW"; bool success = true; for (int i = 0; i < 4; i++) { ans[0] = first[i]; ans[1] = second[i]; for (int j = 1; j < (N - 1); j++) { int next = j + 1; int bfr = j - 1; if (ans[j] == 'S') { if (seq[j] == 'o') { ans[next] = ans[bfr]; } else { if (ans[bfr] == 'S') ans[next] = 'W'; else ans[next] = 'S'; } } else { if (seq[j] == 'o') { if (ans[bfr] == 'S') ans[next] = 'W'; else ans[next] = 'S'; } else { ans[next] = ans[bfr]; } } } success = true; for (int j = 0; j < N; j++) { int next = j + 1; int bfr = j - 1; if (next >= N) next = 0; if (bfr < 0) bfr = N - 1; if (ans[j] == 'S') { if (seq[j] == 'o') { if (ans[bfr] != ans[next]) { success = false; break; } } else { if (ans[bfr] == ans[next]) { success = false; break; } } } else { if (seq[j] == 'o') { if (ans[bfr] == ans[next]) { success = false; break; } } else { if (ans[bfr] != ans[next]) { success = false; break; } } } } if (success) break; } if (success) printf("%s\n", ans); else printf("-1\n"); delete[] seq; delete[] ans; }
a.cc: In function 'void ARC069D_Menagerie()': a.cc:64:9: error: 'getstring' was not declared in this scope 64 | getstring(seq); | ^~~~~~~~~
s129304535
p03800
C++
#include <bits/stdc++.h> using namespace std; char p[100011]; int s[100011],q[100011],n; int main() { cin >>n; cin >>p; for(i=0;p[i];i++) { if(p[i]=='o') q[i+1]=0; else q[i+1]=1; } p[n+1]=p[1]; for(int i=0;i<8;i++) { s[0]=i&1; s[1]=(i>>1)&1; s[2]=(i>>2)&1; for(int j=2;j<=n+1;j++) s[j+1]=s[j-2]^q[j]; if(s[0]^s[n]^s[i]^s[n+1]||s[1]^s[n+1]^s[2]^s[n+2]) continue; for(int j=1;j<=n;j++) cout <<(s[j]^s[j-1]?"W":"S"); cout <<endl; return 0; } puts("-1"); return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: 'i' was not declared in this scope 9 | for(i=0;p[i];i++) | ^
s311491744
p03800
C++
#include <Bits/stdc++.h> using namespace std; int a[10000011]; int main() { int n; string s; cin >>n>>s; s=s+s; for(int i=0;i<2;i++) for(int j=0;j<2;j++) { a[0]=i; a[1]=j; for(int l=2;l<n+2;l++) { if(s[l-1]=='o'&&a[l-1]==0) a[l]=1-a[l-2]; if(s[l-1]=='o'&&a[l-1]==1) a[l]=a[l-2]; if(s[l-1]=='x'&&a[l-1]==0) a[l]=a[l-2]; if(s[l-1]=='x'&&a[l-1]==1) a[l]=1-a[l-2]; } for(int i=0;i<n;i++) cout <<(a[i]?"S":"W"); return 0; } puts("-1"); return 0; }
a.cc:1:10: fatal error: Bits/stdc++.h: No such file or directory 1 | #include <Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s174749808
p03800
C++
#include <Bits/stdc++.h> using namespace std; int a[10000011]; int main() { int n; string s; cin >>n>>s; s=s+s; for(int i=0;i<2;i++) for(int j=0;j<2;j++) { a[0]=i; a[1]=j; for(int l=2;l<n+2;l++) { if(s[l-1]=='o'&&a[l-1]==0) a[l]=1-a[l-2]; if(s[l-1]=='o'&&a[l-1]==1) a[l]=a[l-2]; if(s[l-1]=='x'&&a[l-1]==0) a[l]=a[l-2]; if(s[l-1]=='x'&&a[l-1]==1) a[l]=1-a[l-2]; } for(int i=0;i<n;i++) cout <<(a[i]?"S":"W"); return 0; } puts("-1"); return 0; }
a.cc:1:10: fatal error: Bits/stdc++.h: No such file or directory 1 | #include <Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s109124606
p03800
C++
#include <Bits/stdc++.h> using namespace std; int a[100000011]; int main() { int n; string s; cin >>n>>s; s=s+s; for(int i=0;i<2;i++) for(int j=0;j<2;j++) { a[0]=i; a[1]=j; for(int l=2;l<n+2;l++) { if(s[l-1]=='o'&&a[l-1]==0) a[l]=1-a[l-2]; if(s[l-1]=='o'&&a[l-1]==1) a[l]=a[l-2]; if(s[l-1]=='x'&&a[l-1]==0) a[l]=a[l-2]; if(s[l-1]=='x'&&a[l-1]==1) a[l]=1-a[l-2]; } if(a[n]==a[0]&&a[n+1]==a[1]) { for(int i=0;i<n;i++) cout <<(a[i]?"S":"W"); return 0; } } puts("-1"); return 0; }
a.cc:1:10: fatal error: Bits/stdc++.h: No such file or directory 1 | #include <Bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s110961347
p03800
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define pp pair<int,int> #define ll long long #define ld long double int inf=100000000; ll INF=4000000000000000000; ll MOD=1000000007; int main() { int n; string s; cin >> n >> s; rep(j,4){ vector<int> a(n); a.at(0)=j/2; a.at(1)=j%2; int c; if (s.at(1)=='o') {c=(a.at(0)+a.at(1))%2;} else c=(a.at(0)+1-a.at(1))%2; for (int i=2;i<n-1;i++){ a.at(i)=c; if (s.at(i)=='o') {c=(a.at(i-1)+a.at(i))%2;} else c=(a.at(i-1)+1-a.at(i))%2; } a.at(n-1)=c; if (s.at(n-1)=='o') { if ((a.at(n-2)+a.at(n-1))%2!=a.at(0)) continue; } else if ((a.at(n-2)+1-a.at(n-1))%2!=a.at(0)) continue; string u; rep(i,n){ if (a.at(i)==0) u.push_back('S'); else u.push_back('W'); } sout << u << endl; return 0; } cout << -1 << endl; }
a.cc: In function 'int main()': a.cc:39:3: error: 'sout' was not declared in this scope; did you mean 'stdout'? 39 | sout << u << endl; | ^~~~ | stdout
s336000892
p03800
C++
#include <bits/stdc++.h> using namespace std; #define Int int64_t #define dump(x) cout << (x) << endl #define fi first #define se second Int mod = 1e9+7; Int INF = 1e18; double EPS = 0.00000001; //Int mod = 1e6+3; int main() { Int n; cin >> n; string s; cin >> s; vector<bool> t(n); t[0] = true; if (s[0] == 'o') { t[1] = t[n - 1] = true; } else { t[1] = true; t[n - 1] = false; } for (Int i = 2; i < n - 1; i++) { if (t[i - 1]) { if (s[i - 1] == 'o') { t[i] = t[i - 2]; } else { t[i] = !t[i - 2]; } } else { if (s[i - 1] == 'o') { t[i] = !t[i - 2]; } else { t[i] = t[i - 2]; } } } bool check = true; for (Int i = 0; i < n; i++) { if (t[i]) { if (s[i] == 'o') { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } } else { if (s[i] == 'o') { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } } } if (check) { for (Int i = 0; i < n; i++) cout << (t[i] ? 'S' : 'W'); cout << endl; return 0; } t[0] = true; if (s[0] == 'o') { t[1] = t[n - 1] = false; } else { t[1] = false; t[n - 1] = true; } for (Int i = 2; i < n - 1; i++) { if (t[i - 1]) { if (s[i - 1] == 'o') { t[i] = t[i - 2]; } else { t[i] = !t[i - 2]; } } else { if (s[i - 1] == 'o') { t[i] = !t[i - 2]; } else { t[i] = t[i - 2]; } } } check = true; for (Int i = 0; i < n; i++) { if (t[i]) { if (s[i] == 'o') { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } } else { if (s[i] == 'o') { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } } } if (check) { for (Int i = 0; i < n; i++) cout << (t[i] ? 'S' : 'W'); cout << endl; return 0; } t[0] = false; if (s[0] == 'o') { t[1] = t[n - 1] = true; } else { t[1] = true; t[n - 1] = false; } for (Int i = 2; i < n - 1; i++) { if (t[i - 1]) { if (s[i - 1] == 'o') { t[i] = t[i - 2]; } else { t[i] = !t[i - 2]; } } else { if (s[i - 1] == 'o') { t[i] = !t[i - 2]; } else { t[i] = t[i - 2]; } } } bool check = true; for (Int i = 0; i < n; i++) { if (t[i]) { if (s[i] == 'o') { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } } else { if (s[i] == 'o') { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } } } if (check) { for (Int i = 0; i < n; i++) cout << (t[i] ? 'S' : 'W'); cout << endl; return 0; } t[0] = false; if (s[0] == 'o') { t[1] = t[n - 1] = false; } else { t[1] = false; t[n - 1] = true; } for (Int i = 2; i < n - 1; i++) { if (t[i - 1]) { if (s[i - 1] == 'o') { t[i] = t[i - 2]; } else { t[i] = !t[i - 2]; } } else { if (s[i - 1] == 'o') { t[i] = !t[i - 2]; } else { t[i] = t[i - 2]; } } } check = true; for (Int i = 0; i < n; i++) { if (t[i]) { if (s[i] == 'o') { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } } else { if (s[i] == 'o') { if (t[(n + i - 1) % n] == t[(n + i + 1) % n]) check = false; } else { if (t[(n + i - 1) % n] != t[(n + i + 1) % n]) check = false; } } } if (check) { for (Int i = 0; i < n; i++) cout << (t[i] ? 'S' : 'W'); cout << endl; return 0; } dump(-1); return 0; }
a.cc: In function 'int main()': a.cc:144:10: error: redeclaration of 'bool check' 144 | bool check = true; | ^~~~~ a.cc:44:10: note: 'bool check' previously declared here 44 | bool check = true; | ^~~~~
s109746295
p03800
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; vector<string> start = {"SS", "SW", "WS", "WW"}; for(auto st : start) { string A(N, 'a'); A.at(0) = st.at(0); A.at(1) = st.at(1); for(int i = 2; i < N; i++) { // oS -> SSS WSW if(S.at(i - 1) == 'o' && A.at(i - 1) == 'S') { A.at(i) = A.at(i - 2); } else if(S.at(i - 1) == 'x' && A.at(i - 1) == 'W') { A.at(i) = A.at(i - 2); } else { A.at(i) = (A.at(i - 2) == 'W') ? 'S' : 'W'; } } bool a1 = (A.at(N - 1) == 'S'); bool a2 = (S.at(N - 1) == 'o'); bool a3 = (A.at(N - 2) == A.at(0)); if((int(a1 + a2 + a3) % 2) == 0) continue; bool a1 = (A.at(0) == 'S'); bool a2 = (S.at(0) == 'o'); bool a3 = (A.at(N - 1) == A.at(1)); if(int(a1 + a2 + a3) % 2) { cout << A << endl; return 0; } } cout << -1 << endl; }
a.cc: In function 'int main()': a.cc:30:14: error: redeclaration of 'bool a1' 30 | bool a1 = (A.at(0) == 'S'); | ^~ a.cc:25:14: note: 'bool a1' previously declared here 25 | bool a1 = (A.at(N - 1) == 'S'); | ^~ a.cc:31:14: error: redeclaration of 'bool a2' 31 | bool a2 = (S.at(0) == 'o'); | ^~ a.cc:26:14: note: 'bool a2' previously declared here 26 | bool a2 = (S.at(N - 1) == 'o'); | ^~ a.cc:32:14: error: redeclaration of 'bool a3' 32 | bool a3 = (A.at(N - 1) == A.at(1)); | ^~ a.cc:27:14: note: 'bool a3' previously declared here 27 | bool a3 = (A.at(N - 2) == A.at(0)); | ^~
s847693242
p03800
C++
#include <bits/stdc++.h> using namespace std; char next(char sw,char ox){ if(sw=='S' && ox=='o')return 'S'; if(sw=='S' && ox=='x')return 'W'; if(sw=='W' && ox=='o')return 'W'; if(sw=='W' && ox=='x')return 'S'; } string mkstr(string sw, string ox){ int m=sw.size(),n=ox.size(); for(int i=m+1;i<n;i++){ string x=sw; x+=next(sw[i-1],ox[i]); } return x; } int main(){ int n;cin>>n; string s;cin>>s; vector<string> sws={"SW","WS","SS","WW"}; for(auto&& u:sws){ stirng ret=mkstr(u,s); if(ret.back()==next(u[1],s[0]))cout<<ret<<endl,exit(0); } cout<<-1<<endl; }
a.cc: In function 'std::string mkstr(std::string, std::string)': a.cc:17:16: error: 'x' was not declared in this scope 17 | return x; | ^ a.cc: In function 'int main()': a.cc:27:9: error: 'stirng' was not declared in this scope 27 | stirng ret=mkstr(u,s); | ^~~~~~ a.cc:28:12: error: 'ret' was not declared in this scope 28 | if(ret.back()==next(u[1],s[0]))cout<<ret<<endl,exit(0); | ^~~ a.cc: In function 'char next(char, char)': a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type] 9 | } | ^
s836259324
p03800
C++
#include <bits/stdc++.h> using namespace std; char next(char sw,char ox){ if(sw=='S' && ox='o')return 'S'; if(sw=='S' && ox='x')return 'W'; if(sw=='W' && ox='o')return 'W'; if(sw=='W' && ox='x')return 'S'; } string mkstr(string sw, string ox){ int m=sw.size(),n=ox.size(); for(int i=m+1;i<n;i++){ string x=sw; x+=next(sw[i-1],ox[i]); } return x; } int main(){ int n;cin>>n; string s;cin>>s; vector<string> sws={"SW","WS","SS","WW"}; for(auto&& u:sws){ stirng ret=mkstr(u,s); if(ret.back()==next(u[1],s[0]))cout<<ret<<endl,exit(0); } cout<<-1<<endl; }
a.cc: In function 'char next(char, char)': a.cc:5:20: error: lvalue required as left operand of assignment 5 | if(sw=='S' && ox='o')return 'S'; | ~~~~~~~~^~~~~ a.cc:6:20: error: lvalue required as left operand of assignment 6 | if(sw=='S' && ox='x')return 'W'; | ~~~~~~~~^~~~~ a.cc:7:20: error: lvalue required as left operand of assignment 7 | if(sw=='W' && ox='o')return 'W'; | ~~~~~~~~^~~~~ a.cc:8:20: error: lvalue required as left operand of assignment 8 | if(sw=='W' && ox='x')return 'S'; | ~~~~~~~~^~~~~ a.cc: In function 'std::string mkstr(std::string, std::string)': a.cc:17:16: error: 'x' was not declared in this scope 17 | return x; | ^ a.cc: In function 'int main()': a.cc:25:9: error: 'stirng' was not declared in this scope 25 | stirng ret=mkstr(u,s); | ^~~~~~ a.cc:26:12: error: 'ret' was not declared in this scope 26 | if(ret.back()==next(u[1],s[0]))cout<<ret<<endl,exit(0); | ^~~ a.cc: In function 'char next(char, char)': a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type] 9 | } | ^
s535292821
p03800
C++
#include <bits/stdc++.h> using namespace std; char next(char sw,char ox){ if(sw=='S' && ox='o')return 'S'; if(sw=='S' && ox='x')return 'W'; if(sw=='W' && ox='o')return 'W'; if(sw=='W' && ox='x')return 'S'; }
a.cc: In function 'char next(char, char)': a.cc:5:20: error: lvalue required as left operand of assignment 5 | if(sw=='S' && ox='o')return 'S'; | ~~~~~~~~^~~~~ a.cc:6:20: error: lvalue required as left operand of assignment 6 | if(sw=='S' && ox='x')return 'W'; | ~~~~~~~~^~~~~ a.cc:7:20: error: lvalue required as left operand of assignment 7 | if(sw=='W' && ox='o')return 'W'; | ~~~~~~~~^~~~~ a.cc:8:20: error: lvalue required as left operand of assignment 8 | if(sw=='W' && ox='x')return 'S'; | ~~~~~~~~^~~~~ a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type] 9 | } | ^
s986803527
p03800
C++
#include <bits/stdc++.h> #include <stdio.h> #include<iostream> #include<cstdio> #include<bitset> #include<algorithm> #include<vector> #include<list> #include<queue> #include<stack> #include<string> #include<string.h> #include<cmath> #include<utility> #include<functional> #include<map> #include<set> #include<cctype> #include<fstream> #include <numeric> #include <iomanip> #include <cstring> using namespace std; using ll=long long; #define FOR(i, a, b) for( int i=(a);i<=(b);i++) #define RFOR(i, a, b) for( int i=(a);i>=(b);i--) #define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++) #define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--) #define MOD 1000000007 #define LLONG_MAXs 9223372036854775800 #define ALL(a) (a).begin(),(a).end() #include <iostream> #include <cmath> using namespace std; bool isPrimeNum( ll x ){ // 素数である場合 true を返す if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる return false; } // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト int n = (int)sqrt( (double)x ); for( int i = 2; i <= n; i++ ){ if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了 return false; } } return true; // 割り切る整数がない場合、素数である } ll myPow(ll x, ll n, ll m){ if(n == 0) return 1; if(n % 2 == 0) return myPow(x * x % m, n / 2, m); else return x * myPow(x, n - 1, m) % m; } constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);} constexpr ll abs(ll a,ll b){ if(a>=b)return a-b; if(a<b)return b-a; } constexpr ll min(ll a,ll b){ if(a>=b)return b; if(a<b)return a; } constexpr ll max(ll a,ll b){ if(a>=b)return a; if(a<b)return b; } int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; 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; } }; long long fac[510000], finv[510000], inv[510000]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < 510000; i++){ fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } int main() { ll N; cin >> N; string s; cin>>s; string ans=""; ans.push_back('S'); ans.push_back('S'); FOR(i,2,N-1){ if(ans.at(i-1)=='S'){ if(s.at(i-1)=='o'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } }else{ if(s.at(i-1)=='x'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } } } ll flag=0; if( (ans[N-1]=='S'&&s[N-1]=='o') || (ans[N-1]=='W'&&s[N-1]=='x') ){ if(ans[N-2]!=ans[0])flag++; }else{ if(ans[N-2]==ans[0])flag++; } if( (ans[0]=='S'&&s[0]=='o') || (ans[0]=='W'&&s[0]=='x') ){ if(ans[N-1]!=ans[1])flag++; }else{ if(ans[N-1]==ans[1])flag++; } if(flag==0){ cout<<ans<<endl; return 0; } ans=""; ans.push_back('S'); ans.push_back('W'); FOR(i,2,N-1){ if(ans.at(i-1)=='S'){ if(s.at(i-1)=='o'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } }else{ if(s.at(i-1)=='x'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } } } ll flag=0; if( (ans[N-1]=='S'&&s[N-1]=='o') || (ans[N-1]=='W'&&s[N-1]=='x') ){ if(ans[N-2]!=ans[0])flag++; }else{ if(ans[N-2]==ans[0])flag++; } if( (ans[0]=='S'&&s[0]=='o') || (ans[0]=='W'&&s[0]=='x') ){ if(ans[N-1]!=ans[1])flag++; }else{ if(ans[N-1]==ans[1])flag++; } if(flag==0){ cout<<ans<<endl; return 0; } ans=""; ans.push_back('W'); ans.push_back('S'); FOR(i,2,N-1){ if(ans.at(i-1)=='S'){ if(s.at(i-1)=='o'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } }else{ if(s.at(i-1)=='x'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } } } ll flag=0; if( (ans[N-1]=='S'&&s[N-1]=='o') || (ans[N-1]=='W'&&s[N-1]=='x') ){ if(ans[N-2]!=ans[0])flag++; }else{ if(ans[N-2]==ans[0])flag++; } if( (ans[0]=='S'&&s[0]=='o') || (ans[0]=='W'&&s[0]=='x') ){ if(ans[N-1]!=ans[1])flag++; }else{ if(ans[N-1]==ans[1])flag++; } if(flag==0){ cout<<ans<<endl; return 0; } ans=""; ans.push_back('W'); ans.push_back('W'); FOR(i,2,N-1){ if(ans.at(i-1)=='S'){ if(s.at(i-1)=='o'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } }else{ if(s.at(i-1)=='x'){ ans.push_back(ans[i-2]); }else{ if(ans[i-2]=='S'){ ans.push_back('W'); }else{ ans.push_back('S'); } } } } ll flag=0; if( (ans[N-1]=='S'&&s[N-1]=='o') || (ans[N-1]=='W'&&s[N-1]=='x') ){ if(ans[N-2]!=ans[0])flag++; }else{ if(ans[N-2]==ans[0])flag++; } if( (ans[0]=='S'&&s[0]=='o') || (ans[0]=='W'&&s[0]=='x') ){ if(ans[N-1]!=ans[1])flag++; }else{ if(ans[N-1]==ans[1])flag++; } if(flag==0){ cout<<ans<<endl; return 0; } cout<<"-1"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:237:6: error: redeclaration of 'll flag' 237 | ll flag=0; | ^~~~ a.cc:189:6: note: 'll flag' previously declared here 189 | ll flag=0; | ^~~~ a.cc:282:6: error: redeclaration of 'll flag' 282 | ll flag=0; | ^~~~ a.cc:189:6: note: 'll flag' previously declared here 189 | ll flag=0; | ^~~~ a.cc:327:6: error: redeclaration of 'll flag' 327 | ll flag=0; | ^~~~ a.cc:189:6: note: 'll flag' previously declared here 189 | ll flag=0; | ^~~~
s024130819
p03800
C++
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <fstream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <string> #include <cstring> #include <ctime> #include <limits> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } //math //------------------------------------------- template<class T> inline T sqr(T x) { return x * x; } //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; typedef long long LL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1) #define SORT(c) sort((c).begin(),(c).end()) #define REP(i,n) for(int i=0;i<(int)n;++i) #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) //constant //-------------------------------------------- const double EPS = 1e-10; const double PI = acos(-1.0); const int INF = (int)1000000007; const LL MOD = (LL)1000000007;//10^9+7 const LL INF2 = (LL)100000000000000000;//10^18 int main() { int n; cin >> n; string c; cin >> c; //1が羊 //-1が狼 vector<int> toggle(2); toggle[0] = 1; toggle[1] = -1; vector<int> circle(n); for (auto f : toggle) { for (auto s : toggle) { int left; if (f == 1) { if (c[0] == 'o') { left = s; } else { left = -s; } } else { if (c[0] == 'x') { left = s; } else { left = -s; } } circle[0] = f; circle[1] = s; for (int i = 1; i < n-1; i++) { int now = circle[i]; if (now == 1) { if (c[i] == 'o') { circle[i + 1] = circle[i - 1]; } else { circle[i + 1] = -circle[i - 1]; } } else { if (c[i] == 'x') { circle[i + 1] = circle[i - 1]; } else { circle[i + 1] = -circle[i - 1]; } } } bool done = true; int last = circle[n - 1]; if (last == 1) { if (c[n - 1] == 'o') { if (circle[0] != circle[n - 2]) { done = false; } } else { if (circle[0] == circle[n - 2]) { done = false; } } } else { if (c[n - 1] == 'o') { if (circle[0] == circle[n - 2]) { done = false; } } else { if (circle[0] != circle[n - 2]) { done = false; } } } int last = circle[0]; if (last == 1) { if (c[0] == 'o') { if (circle[1] != circle[n - 1]) { done = false; } } else { if (circle[1] == circle[n - 1]) { done = false; } } } else { if (c[0] == 'o') { if (circle[1] == circle[n - 1]) { done = false; } } else { if (circle[1] != circle[n - 1]) { done = false; } } } for (int i = 1; i < n-1; i++) { int last = circle[i]; if (last == 1) { if (c[i] == 'o') { if (circle[i+1] != circle[i-1]) { done = false; } } else { if (circle[i+1] == circle[i-1]) { done = false; } } } else { if (c[i] == 'o') { if (circle[i+1] == circle[i-1]) { done = false; } } else { if (circle[i+1] != circle[i-1]) { done = false; } } } } if (done) { for (int i = 0; i < n; i++) { if (circle[i] == 1) { cout << "S"; } else { cout << "W"; } } cout << endl; return 0; } } } cout << "-1" << endl; return 0; }
a.cc: In function 'int main()': a.cc:159:29: error: redeclaration of 'int last' 159 | int last = circle[0]; | ^~~~ a.cc:131:29: note: 'int last' previously declared here 131 | int last = circle[n - 1]; | ^~~~
s635187451
p03800
C++
#include <bits/stdc++.h> using namespace std; int n; string s; char conv(char c){ return c == 'W' ? 'S' : 'W'; } char next(char prev, char now){ if(now == 'S') return prev; else return conv(prev); } string restore(char first,char second){ string ret = ""; ret += first; ret += second; char prev = first; char cur = second; char tmp; for(int i = 1;i<n;i++){ if(s[i] == 'o') tmp=next(prev,cur); else tmp = conv(next(conv(prev),conv(cur))); prev = cur; cur = tmp; ret += cur; } return ret; } int main() { cin>>n>>s; char it[2] = {'W','S'}; bool ok = true; for(int i = 0 ; i < 2;i++) for(int j = 0;j<2;j++){ string ans = restore(it[i],it[j]); if(ans[n] != ans[0]) ok = false; char c; if(s[0] == 'o') c = restore(s[0],s[n-1]); else c = conv(restore(conv(s[0]),conv(s[n-1]))); if ( c != s[1]) ok = false; if(!ok) continue; else for(int k = 0 ; k<n;k++){ cout<<ans[k]; return 0;} } cout<<"-1"; return 0; }
a.cc: In function 'int main()': a.cc:42:44: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char' in assignment 42 | c = restore(s[0],s[n-1]); | ~~~~~~~^~~~~~~~~~~~~ | | | std::string {aka std::__cxx11::basic_string<char>} a.cc:44:49: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char' 44 | c = conv(restore(conv(s[0]),conv(s[n-1]))); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ | | | std::string {aka std::__cxx11::basic_string<char>} a.cc:5:16: note: initializing argument 1 of 'char conv(char)' 5 | char conv(char c){ | ~~~~~^
s911594894
p03800
C++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cmath> #include <algorithm> #include <vector> #include <numeric> #include <queue> #include <map> #include <set> #include <string> #include <functional> #include <list> #include <random> #include <time.h> #include <iomanip> #include <assert.h> #include <numeric> #define int long long #define double long double #define oku7 1000000007 #define MAXN (int)1e+5 * 2+1 #define LL_MAX 9223372036854775807 //ない環境用 #define LL_HALFMAX 9223372036854775807 / 2 //ない環境用 using namespace std; std::mt19937 mt((int)time(0)); int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位 int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位 char cases[4][100001]; int N; string s; int getNextIndex(int now, int mod) { return (now + 1) % mod; } int getPrevIndex(int now, int mod) { return (now + mod - 1) % mod; } bool chk(int casenum, int index) { int next = getNextIndex(index, N); int prev = getPrevIndex(index, N); if (s[index] == 'o') { if (cases[casenum][index] == 'S' && cases[casenum][next] == cases[casenum][prev]) { return true; } if (cases[casenum][index] == 'W' && cases[casenum][next] != cases[casenum][prev]) { return true; } } else { if (cases[casenum][index] == 'S' && cases[casenum][next] != cases[casenum][prev]) { return true; } if (cases[casenum][index] == 'W' && cases[casenum][next] == cases[casenum][prev]) { return true; } } return false; } signed main() { cin >> N >> s; strcpy(cases[0], "SS"); strcpy(cases[1], "SW"); strcpy(cases[2], "WS"); strcpy(cases[3], "WW"); bool flag = false; for (int i = 0; i < 4; i++) { int nowIndex = 1; while (cases[i][getNextIndex(nowIndex, N)] == '\0') { if (cases[i][nowIndex] == 'S') { if (s[nowIndex] == 'o') { cases[i][nowIndex + 1] = cases[i][nowIndex - 1]; } else if(cases[i][nowIndex-1] == 'S'){ cases[i][nowIndex + 1] = 'W'; } else { cases[i][nowIndex + 1] = 'S'; } } else { if (s[nowIndex] == 'x') { cases[i][nowIndex + 1] = cases[i][nowIndex - 1]; } else if (cases[i][nowIndex - 1] == 'S') { cases[i][nowIndex + 1] = 'W'; } else { cases[i][nowIndex + 1] = 'S'; } } nowIndex = getNextIndex(nowIndex, N); } if (chk(i, 0) && chk(i, N - 1)) { flag = true; cout << cases[i] << "\n"; break; } } if (!flag) cout << "-1\n"; return 0; }
a.cc: In function 'int main()': a.cc:68:9: error: 'strcpy' was not declared in this scope 68 | strcpy(cases[0], "SS"); | ^~~~~~ a.cc:17:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 16 | #include <assert.h> +++ |+#include <cstring> 17 | #include <numeric>