submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s377075147
p04018
C++
、#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef unsigned long long ulint; typedef pair<int, int> pii; typedef pair<lint, lint> pll; #define endl '\n' #define next next_ #define fst first #define sed second #define pb push_back #define mp make_pair #define rint register int #define newline putchar('\n') #define leave_space puthchar(' ') #define all(x) (x).begin(), (x).end() #define reveal(x) cerr << #x << " = " << (x) << endl #define rep(it, f, e) for (rint it = f; it <= e; ++it) #define per(it, f, e) for (rint it = f; it >= e; --it) const int MAXN = 5e5 + 20; char s[MAXN], t[MAXN]; int n, fail1[MAXN], fail2[MAXN]; inline void getfail(int fail[], char S[]) { int j = fail[0] = -1; rep (i, 1, n - 1) { while(j >= 0 && S[i] != S[j]) j = fail[j]; fail[i + 1] = ++j; } } inline bool check_cyc1(int x) { return fail1[x] == 0 || x % (x - fail1[x]); } inline bool check_cyc2(int x) { if (x == 0) return false; return fail2[x] == 0 || x % (x - fail2[x]); } int main() { scanf("%s", s); n = strlen(s); memcpy(t, s, sizeof(t)); reverse(t, t + n); getfail(fail1, s); getfail(fail2, t); //int res = check_cyc1(n) ? 1 : 2; int flag = check_cyc1(n) ? 1 : 2, ans = 0; bool f = true; for (int i = 1; i < n; ++i) if (s[i] != s[i - 1]) { f = false; break; } if (f) flag = n; cout << flag << '\n'; if (flag != 2) { cout << 1; return 0; } for (int i = 0; i < n; ++i) { int tmp = n - i - 1; if (check_cyc1(i + 1) && check_cyc2(tmp)) ++ans; } cout << ans; /*bool flag = true; rep (i, 1, n - 1) { if (s[i] != s[i - 1]) { flag = false; break; } } if (flag) { cout << n << endl; cout << 1 << endl; } else if (res == 1) { cout << 1 << endl; cout << 1 << endl; } else { int ans = 0; rep (i, 0, n - 1) { ans += (check_cyc1(i + 1) && check_cyc2(n - i - 1)); } cout << 2 << endl; cout << ans << endl; }*/ return 0; }
a.cc:1:1: error: extended character 、 is not valid in an identifier 1 | 、#include <bits/stdc++.h> | ^ a.cc:1:3: error: stray '#' in program 1 | 、#include <bits/stdc++.h> | ^ a.cc:1:1: error: '\U00003001' does not name a type 1 | 、#include <bits/stdc++.h> | ^~ a.cc:5:9: error: 'pair' does not name a type 5 | typedef pair<int, int> pii; | ^~~~ a.cc:6:9: error: 'pair' does not name a type 6 | typedef pair<lint, lint> pll; | ^~~~ a.cc: In function 'void getfail(int*, char*)': a.cc:25:14: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 25 | rep (i, 1, n - 1) { | ^ a.cc:18:33: note: in definition of macro 'rep' 18 | #define rep(it, f, e) for (rint it = f; it <= e; ++it) | ^~ a.cc: In function 'int main()': a.cc:38:9: error: 'scanf' was not declared in this scope 38 | scanf("%s", s); | ^~~~~ a.cc:39:13: error: 'strlen' was not declared in this scope 39 | n = strlen(s); | ^~~~~~ a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | 、#include <bits/stdc++.h> a.cc:40:9: error: 'memcpy' was not declared in this scope 40 | memcpy(t, s, sizeof(t)); | ^~~~~~ a.cc:40:9: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:41:9: error: 'reverse' was not declared in this scope 41 | reverse(t, t + n); | ^~~~~~~ a.cc:50:9: error: 'cout' was not declared in this scope 50 | cout << flag << '\n'; | ^~~~
s437054623
p04018
C++
#include<iostream> #include<fstream> #include<sstream> #include<algorithm> #include<cstdio> #include<cassert> #include<cmath> #include<cstdlib> #include<cstring> #include<string> #include<deque> #include<queue> #include<vector> #include<list> #include<map> #include<set> #include<bitset> #include<stack> #include<iomanip> #include<utility> #include<functional> using namespace std; int fail[500005]; string s; int gnext(string s,char c,int j) { if(j==-1||s[j]==c) return j+1; else return gnext(s,c,fail[j]); } void gfail(string s) { fail[0]=-1; int j=0; for(int i=1;i<s.size();i++) { fail[i]=j; j=gnext(s,s[i],j); } } int main() { cin>>s; gfail(s); int n=s.size(); int k=n-1-fail[n-1]; if(n%k!=0) cout<<1<<endl<<1; else if(k!=1) { cout<<2<<endl; if(n/k!=2) cout<<n-1-(n/k)+1; else cout<<n-1; } else cout<<n<<endel<<1; return 0; }
a.cc: In function 'int main()': a.cc:59:26: error: 'endel' was not declared in this scope 59 | cout<<n<<endel<<1; | ^~~~~
s649609689
p04018
C++
#include <cstdio> #include <cstring> #include <algorithm> #include <cstdlib> using namespace std; #define N 500050 char w[N]; int nxt[N],n,txn[N]; bool check1(int x) { if(x<2) return 1; int t=x-nxt[x]; return t==x||x%t>0; } bool check2(int x) { if(x>n-1) return 1; int t=(n-x+1)-(n-txn[x]+1); return t==(n-x+1)||(n-x+1)%t>0; } int main() { fread(w+1,500005,stdin); n=strlen(w+1)-1; if(n==1) {puts("1\n1\n"); return 0;} if(n==2) { if(w[1]==w[2]) puts("2\n1\n"); else puts("1\n1\n"); return 0; } int i; int flg=0; for(i=2;i<=n;i++) if(w[i]!=w[i-1]) {flg=1;break;} if(!flg) {printf("%d\n1\n",n); return 0;} nxt[1]=0; int j=0; for(i=2;i<=n;i++) { for(;j&&w[i]!=w[j+1];j=nxt[j]) ; if(w[i]==w[j+1]) j++; nxt[i]=j; } int t=n-nxt[n]; if(t==n||n%t) { printf("1\n1\n"); return 0; } printf("%d\n",2); txn[n]=n+1; j=n+1; for(i=n-1;i;i--) { for(;j<=n&&w[i]!=w[j-1];j=txn[j]) ; if(w[i]==w[j-1]) j--; txn[i]=j; } int ans=0; for(i=1;i<n;i++) { if(check1(i)&&check2(i+1)) ans++; } printf("%d\n",ans); }
In file included from /usr/include/c++/14/cstdio:42, from a.cc:1: a.cc: In function 'int main()': a.cc:20:26: error: invalid conversion from 'FILE*' to 'size_t' {aka 'long unsigned int'} [-fpermissive] 20 | fread(w+1,500005,stdin); | ^~~~~ | | | FILE* a.cc:20:14: error: too few arguments to function 'size_t fread(void*, size_t, size_t, FILE*)' 20 | fread(w+1,500005,stdin); | ~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/stdio.h:728:15: note: declared here 728 | extern size_t fread (void *__restrict __ptr, size_t __size, | ^~~~~
s282869252
p04018
C++
#include <bits/stdc++.h> #define PB push_back #define LL long long const int mod = 924844033; using namespace std; LL p = 235743; LL pwr[500005]; LL pref[500005]; LL hsh(int l , int r) { return pref[r] - (l ? pref[l - 1] : 0); } bool check(string s , int div) { for(int i = div; i < s.size(); i += div) { if(s.substr(0 , div - 1) != s.substr(i , i + div - 1)) { return false; } } return true; } bool good(string s) { bool res = true; for(int div = 1; div < s.size(); div++) { if(s.size() % div == 0) { res &= !check(s , div); } } return res; } int bad1[500005]; int bad2[500005]; int main() { pwr[0] = 1; for(int i = 1; i <= 500000; i++) { pwr[i] = p * pwr[i - 1]; } ios_base::sync_with_stdio(0); string s; cin >> s; if(s.size() > 4000) return 0; for(int i = 0; i < s.size(); i++) pref[i] = s[i] * pwr[i] + (i ? pref[i - 1] : 0); bool allEq = true; for(auto x : s) allEq &= s[0] == x; if(allEq) { cout << s.size() << endl << 1 << endl; return 0; } if(good(s)) { cout << 1 << endl << 1 << endl; return 0; } for(int len = 1; len <= s.size(); len++) { for(int i = len; i + len <= s.size(); i += len) { if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) { bad1[i + len] = 1; } else break; } } reverse(s.begin() , s.end()); for(int i = 0; i < s.size(); i++) pref[i] = s[i] * pwr[i] + (i ? pref[i - 1] : 0); for(int len = 1; len <= s.size(); len++) { for(int i = len; i + len <= s.size(); i += len) { if(s.substr(0 , i - 1) == s.substr(i , i + len - 1)) { bad2[i + len] = 1; } else break; } } int ways = 0; for(int i = 1; i < s.size(); i++) { ways += !bad1[i] && !bad2[s.size() - i]; } cout << 2 << endl << ways << endl; return 0; }
a.cc: In function 'int main()': a.cc:71:48: error: no match for 'operator*' (operand types are 'std::__cxx11::basic_string<char>' and 'long long int') 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~ | | | | | long long int | std::__cxx11::basic_string<char> In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/complex:400:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const complex<_Tp>&)' 400 | operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:400:5: note: template argument deduction/substitution failed: a.cc:71:55: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::complex<_Tp>' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/complex:409:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const _Tp&)' 409 | operator*(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:409:5: note: template argument deduction/substitution failed: a.cc:71:55: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::complex<_Tp>' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/complex:418:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const complex<_Tp>&)' 418 | operator*(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:418:5: note: template argument deduction/substitution failed: a.cc:71:55: note: mismatched types 'const std::complex<_Tp>' and 'long long int' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: a.cc:71:55: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: a.cc:71:55: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: a.cc:71:55: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: a.cc:71:55: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/bits/valarray_after.h:407:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__multiplies, typename _Dom1::value_type>::result_type> std::operator*(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 407 | _DEFINE_EXPR_BINARY_OPERATOR(*, struct std::__multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:407:5: note: template argument deduction/substitution failed: a.cc:71:55: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'long long int' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const valarray<_Tp>&, const valarray<_Tp>&)' 1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed: a.cc:71:55: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::valarray<_Tp>' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed: a.cc:71:55: note: 'std::__cxx11::basic_string<char>' is not derived from 'const std::valarray<_Tp>' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^ /usr/include/c++/14/valarray:1198:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__multiplies, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__multiplies, _Tp>::result_type> std::operator*(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1198 | _DEFINE_BINARY_OPERATOR(*, __multiplies) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1198:1: note: template argument deduction/substitution failed: a.cc:71:55: note: mismatched types 'const std::valarray<_Tp>' and 'long long int' 71 | if(s.substr(0 , i - 1) * pwr[i] == s.substr(i , i + len - 1)) | ^
s894660675
p04018
C++
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <ctime> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; #define rep(i, l, r) for (int i = l; i <= r; i ++) #define dwn(i, r, l) for (int i = r; i >= l; i --) #define repG(u, i) for (int i = hd[u]; i; i = e[i].nxt) #define ev e[i].v #define ec e[i].c #define sqr(x) (x)*(x) #define rlxX(x, y) x = max(x, y) #define rlxN(x, y) x = min(x, y) #define clr(a, b) memset(a, b, sizeof(a)) #define gc getchar() typedef long long LL; typedef double db; const int N = 1e5 + 5, INF = 1e9 + 7; int rd() { char ch = gc; int ret = 0; while (ch < '0' || ch > '9') ch = gc; while (ch >= '0' && ch <= '9') ret = ret*10 + ch-'0', ch = gc; return ret; } int n, n0[N], n1[N]; char str0[N], str1[N]; void getnext(char str[], int next[]) { //cout << str+1 << endl; int j = 0; next[1] = 0; rep(i, 2, n) { while (j && str[j+1] != str[i]) j = next[j]; if (str[j+1] == str[i]) j ++; next[i] = j; } //cout << n << endl; //rep(i, 1, n) printf("%d ", next[i]); puts(""); } bool can(int x, int y) {return x==y || x%y;} int main(){ //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); scanf("%s", str0+1); n = strlen(str0+1); getnext(str0, n0); //cout << n0[n] << endl; if (can(n, n-n0[n])) {puts("1\n1"); return 0;} if (n-n0[n] == 1) {printf("%d\n1\n", n); return 0;} strcpy(str1+1, str0+1); //cout << str1+1 << endl; strrev(str1+1); getnext(str1, n1); int ans = 0; rep(i, 1, n-1) if (can(i, i-n0[i]) && can(n-i, n-i-n1[n-i])) ans ++; printf("%d\n%d\n", 2, ans); return 0; } /* */
a.cc: In function 'int main()': a.cc:67:9: error: 'strrev' was not declared in this scope; did you mean 'strsep'? 67 | strrev(str1+1); | ^~~~~~ | strsep
s289182293
p04018
C++
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> #include <ctime> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; #define rep(i, l, r) for (int i = l; i <= r; i ++) #define dwn(i, r, l) for (int i = r; i >= l; i --) #define repG(u, i) for (int i = hd[u]; i; i = e[i].nxt) #define ev e[i].v #define ec e[i].c #define sqr(x) (x)*(x) #define rlxX(x, y) x = max(x, y) #define rlxN(x, y) x = min(x, y) #define clr(a, b) memset(a, b, sizeof(a)) #define gc getchar() typedef long long LL; typedef double db; const int N = 1e5 + 5, INF = 1e9 + 7; int rd() { char ch = gc; int ret = 0; while (ch < '0' || ch > '9') ch = gc; while (ch >= '0' && ch <= '9') ret = ret*10 + ch-'0', ch = gc; return ret; } int n, n0[N], n1[N]; char str0[N], str1[N]; void getnext(char str[], int next[]) { //cout << str+1 << endl; int j = 0; next[1] = 0; rep(i, 2, n) { while (j && str[j+1] != str[i]) j = next[j]; if (str[j+1] == str[i]) j ++; next[i] = j; } //cout << n << endl; //rep(i, 1, n) printf("%d ", next[i]); puts(""); } bool can(int x, int y) {return x==y || x%y;} int main(){ //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); scanf("%s", str0+1); n = strlen(str0+1); getnext(str0, n0); //cout << n0[n] << endl; if (can(n, n-n0[n])) {puts("1\n1"); return 0;} if (n-n0[n] == 1) {printf("%d\n1\n", n); return 0;} strcpy(str1+1, str0+1); //cout << str1+1 << endl; strrev(str1+1); getnext(str1, n1); int ans = 0; rep(i, 1, n-1) if (can(i, i-n0[i]) && can(n-i, n-i-n1[n-i])) ans ++; printf("%d\n%d\n", 2, ans); return 0; } /* */
a.cc: In function 'int main()': a.cc:66:9: error: 'strrev' was not declared in this scope; did you mean 'strsep'? 66 | strrev(str1+1); | ^~~~~~ | strsep
s030594056
p04018
C++
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> #include <ctime> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; #define rep(i, l, r) for (int i = l; i <= r; i ++) #define dwn(i, r, l) for (int i = r; i >= l; i --) #define repG(u, i) for (int i = hd[u]; i; i = e[i].nxt) #define ev e[i].v #define ec e[i].c #define sqr(x) (x)*(x) #define rlxX(x, y) x = max(x, y) #define rlxN(x, y) x = min(x, y) #define clr(a, b) memset(a, b, sizeof(a)) #define gc getchar() typedef long long LL; typedef double db; const int N = 1e5 + 5, INF = 1e9 + 7; int rd() { char ch = gc; int ret = 0; while (ch < '0' || ch > '9') ch = gc; while (ch >= '0' && ch <= '9') ret = ret*10 + ch-'0', ch = gc; return ret; } int n, n0[N], n1[N]; char str0[N], str1[N]; void getnext(char str[], int next[]) { //cout << str+1 << endl; int j = 0; next[1] = 0; rep(i, 2, n) { while (j && str[j+1] != str[i]) j = next[j]; if (str[j+1] == str[i]) j ++; next[i] = j; } //cout << n << endl; //rep(i, 1, n) printf("%d ", next[i]); puts(""); } bool can(int x, int y) {return x==y || x%y;} int main(){ //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); scanf("%s", str0+1); n = strlen(str0+1); getnext(str0, n0); //cout << n0[n] << endl; if (can(n, n-n0[n])) {puts("1\n1"); return 0;} if (n-n0[n] == 1) {printf("%d\n1\n", n, 1); return 0;} strcpy(str1+1, str0+1); //cout << str1+1 << endl; strrev(str1+1); getnext(str1, n1); int ans = 0; rep(i, 1, n-1) if (can(i, i-n0[i]) && can(n-i, n-i-n1[n-i])) ans ++; printf("%d\n%d\n", 2, ans); return 0; } /* */
a.cc: In function 'int main()': a.cc:66:9: error: 'strrev' was not declared in this scope; did you mean 'strsep'? 66 | strrev(str1+1); | ^~~~~~ | strsep
s866415994
p04018
C++
#include<bits/stdc++.h> #define N 500005 #define mod 1000000007 #define base 37 using namespace std; inline int read(){ int ans=0; char ch=getchar(); while(!isdigit(ch))ch=getchar(); while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar(); return ans; } char s[N]; int n,a[N]; unsigned int mul[N],hash[N]; inline bool check(int len,int dis){ int l=1,r=len; if(dis==len)return false; for(;l<=dis&&r<=dis;l+=len,r+=len)if(hash[r]-hash[l-1]!=hash[len]*mul[l-1])return false; return true; } inline int calc(int len){ int ret=n/len*(len-1); if(n&1)return ret; if(check(len,n/2))return ret; return ret+1; } int main(){ scanf("%s",s+1),n=strlen(s+1); for(int i=1;i<=n;++i)a[i]=s[i]-'a'; bool f=true; for(int i=2;i<=n;++i)if(a[i]!=a[i-1]){f=false;break;} if(f){printf("%d\n1",n);return 0;} mul[0]=1; for(int i=1;i<=n;++i)mul[i]=mul[i-1]*base; for(int i=1;i<=n;++i)hash[i]=hash[i-1]*base+a[i]; for(int len=2;len<n;++len){ if(n%len)continue; if(check(len,n)){printf("2\n%d",calc(len));return 0;} } printf("1\n1"); return 0; }
a.cc: In function 'bool check(int, int)': a.cc:19:46: error: reference to 'hash' is ambiguous 19 | for(;l<=dis&&r<=dis;l+=len,r+=len)if(hash[r]-hash[l-1]!=hash[len]*mul[l-1])return false; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:21: note: 'unsigned int hash [500005]' 15 | unsigned int mul[N],hash[N]; | ^~~~ a.cc:19:54: error: reference to 'hash' is ambiguous 19 | for(;l<=dis&&r<=dis;l+=len,r+=len)if(hash[r]-hash[l-1]!=hash[len]*mul[l-1])return false; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:21: note: 'unsigned int hash [500005]' 15 | unsigned int mul[N],hash[N]; | ^~~~ a.cc:19:65: error: reference to 'hash' is ambiguous 19 | for(;l<=dis&&r<=dis;l+=len,r+=len)if(hash[r]-hash[l-1]!=hash[len]*mul[l-1])return false; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:21: note: 'unsigned int hash [500005]' 15 | unsigned int mul[N],hash[N]; | ^~~~ a.cc: In function 'int main()': a.cc:36:30: error: reference to 'hash' is ambiguous 36 | for(int i=1;i<=n;++i)hash[i]=hash[i-1]*base+a[i]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:21: note: 'unsigned int hash [500005]' 15 | unsigned int mul[N],hash[N]; | ^~~~ a.cc:36:38: error: reference to 'hash' is ambiguous 36 | for(int i=1;i<=n;++i)hash[i]=hash[i-1]*base+a[i]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:21: note: 'unsigned int hash [500005]' 15 | unsigned int mul[N],hash[N]; | ^~~~
s399000042
p04018
C++
#include<cstdio> #include<vector> #include<cstring> #include<queue> #include<cmath> #include<algorithm> using namespace std; const long long MAXN=500005,MOD=1e9+7,p=131; long long hash[MAXN]; long long bitp[MAXN]; char s[MAXN]; long long l[MAXN],r[MAXN],len; long long Hash(long long x,long long y) { return ((hash[y]-hash[x-1]*bitp[y-x+1])%MOD+MOD)%MOD; } bool check() { for(long long i=2;i<=len;i++) if(s[i]!=s[i-1]) return 0; return 1; } int main() { scanf("%s",s+1); len=strlen(s+1); if(check()) { printf("%lld\n1\n",len); return 0; } bitp[0]=1; for(long long i=1;i<=len;i++) { hash[i]=(hash[i-1]*p+s[i])%MOD; bitp[i]=(bitp[i-1]*p)%MOD; } for(long long d=1;d<=len;d++) for(long long i=2*d;i<=len;i+=d) if(Hash(1,i-d)==Hash(d+1,i)) l[i]=1; for(long long d=1;d<=len;d++) for(long long i=len-2*d+1;i>=1;i-=d) if(Hash(i+d,len)==Hash(i,len-d)) r[i]=1; long long ans=0; for(long long i=1;i<=len;i++) { if(!l[i]&&!r[i+1]) ans++; } if(!l[len]) printf("1\n1\n"); else printf("2\n%lld\n",ans); }
a.cc: In function 'long long int Hash(long long int, long long int)': a.cc:15:18: error: reference to 'hash' is ambiguous 15 | return ((hash[y]-hash[x-1]*bitp[y-x+1])%MOD+MOD)%MOD; | ^~~~ In file included from /usr/include/c++/14/bits/stl_bvector.h:65, from /usr/include/c++/14/vector:67, from a.cc:2: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:9:11: note: 'long long int hash [500005]' 9 | long long hash[MAXN]; | ^~~~ a.cc:15:26: error: reference to 'hash' is ambiguous 15 | return ((hash[y]-hash[x-1]*bitp[y-x+1])%MOD+MOD)%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:9:11: note: 'long long int hash [500005]' 9 | long long hash[MAXN]; | ^~~~ a.cc: In function 'int main()': a.cc:36:17: error: reference to 'hash' is ambiguous 36 | hash[i]=(hash[i-1]*p+s[i])%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:9:11: note: 'long long int hash [500005]' 9 | long long hash[MAXN]; | ^~~~ a.cc:36:26: error: reference to 'hash' is ambiguous 36 | hash[i]=(hash[i-1]*p+s[i])%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:9:11: note: 'long long int hash [500005]' 9 | long long hash[MAXN]; | ^~~~
s913775717
p04018
C++
#include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<iostream> using namespace std; typedef long long ll; const ll MOD=1e9+7; const ll base=1123; const int MAXN=5e5+5; string s; int n; ll pow[MAXN],hash[MAXN]; bool l[MAXN],r[MAXN]; void Init(){ s=' '+s; n=s.length(); pow[0]=1; for(int i=1;i<=n;i++) pow[i]=(1ll*pow[i-1]*base)%MOD; for(int i=1;i<=n;i++) hash[i]=(1ll*hash[i-1]*base+s[i]-'a')%MOD; } ll get(int l,int r){ return ((1ll*hash[r]-1ll*hash[l-1]*pow[r-l+1])%MOD+MOD)%MOD; } int main(){ cin >> s; bool same=1; for(int i=1;i<s.length();i++) if(s[i]!=s[i-1]){same=0;break;} if(same) return printf("%d\n1",s.length()),0; Init(); for(int i=1;i<=n;i++) for(int j=i*2;j<=n;j+=i){ if(get(1,i)==get(j-i+1,j)) l[j]=1; else break; } for(int i=1;i<=n;i++) for(int j=n-i*2+1;j>=1;j-=i){ if(get(j,j+i-1)==get(n-i+1,n)) r[j]=1; else break; } if(l[n]) return printf("1\n1"),0; int ans=0; for(int i=1;i<n;i++) if(!l[i]&&!r[i+1]) ans++; printf("2\n%d",ans); }
a.cc:15:4: warning: built-in function 'pow' declared as non-function [-Wbuiltin-declaration-mismatch] 15 | ll pow[MAXN],hash[MAXN]; | ^~~ a.cc: In function 'void Init()': a.cc:23:27: error: reference to 'hash' is ambiguous 23 | for(int i=1;i<=n;i++) hash[i]=(1ll*hash[i-1]*base+s[i]-'a')%MOD; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from a.cc:4: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:14: note: 'll hash [500005]' 15 | ll pow[MAXN],hash[MAXN]; | ^~~~ a.cc:23:40: error: reference to 'hash' is ambiguous 23 | for(int i=1;i<=n;i++) hash[i]=(1ll*hash[i-1]*base+s[i]-'a')%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:14: note: 'll hash [500005]' 15 | ll pow[MAXN],hash[MAXN]; | ^~~~ a.cc: In function 'll get(int, int)': a.cc:27:18: error: reference to 'hash' is ambiguous 27 | return ((1ll*hash[r]-1ll*hash[l-1]*pow[r-l+1])%MOD+MOD)%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:14: note: 'll hash [500005]' 15 | ll pow[MAXN],hash[MAXN]; | ^~~~ a.cc:27:30: error: reference to 'hash' is ambiguous 27 | return ((1ll*hash[r]-1ll*hash[l-1]*pow[r-l+1])%MOD+MOD)%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:15:14: note: 'll hash [500005]' 15 | ll pow[MAXN],hash[MAXN]; | ^~~~
s137710234
p04018
C++
#include <bits/stdc++.h> #define f(a, n) for (int a = 0; a<n; a++) using namespace std; string s; bool isrep(string s, int t){ f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; return 1; } int main(){ cin>>s; if (s.size == 1) { cout<<"2"<<endl; return 0; } f(i, s.size()-1) if (i>1) if (s.size() % i == 0){ if (isrep (s, i)) {cout<<"2"<<endl; return 0;} } cout<<"1"<<endl; }
a.cc: In function 'bool isrep(std::string, int)': a.cc:6:27: error: no match for 'operator/' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ~^~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/complex:430:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const complex<_Tp>&)' 430 | operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:430:5: note: template argument deduction/substitution failed: a.cc:6:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/complex:439:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const _Tp&)' 439 | operator/(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:439:5: note: template argument deduction/substitution failed: a.cc:6:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/complex:448:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const _Tp&, const complex<_Tp>&)' 448 | operator/(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:448:5: note: template argument deduction/substitution failed: a.cc:6:28: note: mismatched types 'const std::complex<_Tp>' and 'int' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:408:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: a.cc:6:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/bits/valarray_after.h:408:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: a.cc:6:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/bits/valarray_after.h:408:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: a.cc:6:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/bits/valarray_after.h:408:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: a.cc:6:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/bits/valarray_after.h:408:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: a.cc:6:28: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/valarray:1199:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const valarray<_Tp>&, const valarray<_Tp>&)' 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1199:1: note: template argument deduction/substitution failed: a.cc:6:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/valarray:1199:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1199:1: note: template argument deduction/substitution failed: a.cc:6:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/valarray:1199:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1199:1: note: template argument deduction/substitution failed: a.cc:6:28: note: mismatched types 'const std::valarray<_Tp>' and 'int' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ a.cc:6:59: error: no match for 'operator/' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ~^~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} /usr/include/c++/14/complex:430:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const complex<_Tp>&)' 430 | operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:430:5: note: template argument deduction/substitution failed: a.cc:6:60: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 6 | f(i, s.size()) if (i + s/t < s.size()) if (s[i] != s[i+s/t]) return 0; | ^ /usr/include/c++/14/complex:439:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const _Tp&)' 439 | operator/(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:439:5: note: template argument deduction/substitution failed: a.cc:6:60: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const st
s077747997
p04018
C++
#include <bits/stdc++.h> #define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME #define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl #define pr1(a) (#a)<<"="<<(a)<<" " #define pr2(a,b) pr1(a)<<pr1(b) #define pr3(a,b,c) pr1(a)<<pr2(b,c) #define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d) #define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e) #define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f) #define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g) #define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h) using namespace std; using Int = long long; using ll = long long; using Double = long double; const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16 const Int mod = (1e9)+7; const Double EPS = 1e-8; const Double PI = 6.0 * asin((Double)0.5); using P = pair<Int,Int>; using T = tuple<Int,Int,Int>; template<class T> T Max(T &a,T b){return a=max(a,b);} template<class T> T Min(T &a,T b){return a=min(a,b);} ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";} ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";} istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;} ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;} istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;} void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;} class RollingHash{ public: typedef long long ll; ll B, mod; //B: ハッシュ基数 Int n; string s; vector<ll> hash; vector<ll> k; RollingHash():n(-1){}; RollingHash(string s,ll B = 1777771,ll mod = 1e9 + 7): B(B),mod(mod),n(s.size()),s(s),hash(n+1),k(n+1) { for(Int i=0;i<n;i++) hash[i+1] = (hash[i] * B % mod + s[i]) % mod; k[0] = 1; for(Int i=1;i<=n;i++) k[i] = (k[i-1] * B) % mod; } ll get(Int l,Int r){ //[l, r) assert(0<=l && r<=n && l<=r); return (mod + hash[r] - hash[l] * k[r-l] % mod) % mod; } //hash[a]とB.hash[b]からみて何文字一致してるか。 Int count(Int a, RollingHash &B, Int b){ Int L = 0, R = min( n - a, B.n - b ) + 1; while( L + 1 < R ){ Int M = ( L + R ) / 2; get( a, a + M ) != B.get( b, b + M ) ? R = M : L = M; } return L; } }; typedef unsigned long long ull; RollingHash R; Int n; string str; vector<vector<Int> > Div(5000); bool can(Int l,Int r){//[l,r) Int len = r - l; if(len == 1) return 1; auto check=[&](Int i){ ull a = R.get(l+i, r); ull b = R.get(l, r - i); return a != b; }; for(Int i=1:Div){ if(len%i) continue; if(i!=1 && check(len/i) == false) return 0; if(check(i) == false) return 0; } return 1; } Int dfs(Int idx){ static Int used[10000]={}, mem[10000] = {}; if(idx == n) return 0; if(used[idx]++) return mem[idx]; Int res = INF; for(Int nidx = idx+1; nidx <= n; nidx++){ if(!can(idx, nidx)) continue; Min(res, 1+dfs(nidx)); } return mem[idx] = res; } Int count(Int idx){ static Int used[10000]={}, mem[10000]; if(idx == n) return 1; if(used[idx]++) return mem[idx]; Int res = 0; Int mn = dfs(idx); for(Int nidx = idx+1; nidx <= n; nidx++){ if(!can(idx, nidx)) continue; if(mn != 1 + dfs(nidx)) continue; res = (res + count(nidx)) % mod; } return res; } signed main(){ cin.tie(0); ios_base::sync_with_stdio(0); cout << fixed << setprecision(12); for(Int i=1;i<=5000;i++) for(Int j=1;j<i;j++) if(i%j == 0) Div[i].push_back(j); cin>>str; n = str.size(); R = RollingHash(str); assert(n <= 4000); Int len = dfs(0); Int cnt = count(0); cout<<len<<endl; cout<<cnt<<endl; return 0; }
a.cc:27:39: warning: use of 'auto' in template argument only available with '-fconcepts-ts' 27 | ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;} | ^~~~ a.cc:28:39: warning: use of 'auto' in template argument only available with '-fconcepts-ts' 28 | istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;} | ^~~~ a.cc:29:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts' 29 | void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;} | ^~~~ a.cc: In function 'bool can(Int, Int)': a.cc:80:12: error: initializer in range-based 'for' loop 80 | for(Int i=1:Div){ | ^
s655776772
p04018
C++
#include<bits/stdc++.h> using namespace std; using Int = long long; struct FastIO{ FastIO(){ cin.tie(0); ios::sync_with_stdio(0); } }fastio_beet; struct RollingHash{ typedef unsigned long long ull; string S; ull B; Int len; vector<ull> hash,p; RollingHash(){} RollingHash(string S_,ull B_=1000000007LL): S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){ hash[0]=0;p[0]=1; for(Int i=0;i<len;i++){ hash[i+1]=hash[i]*B+S[i]; p[i+1]=p[i]*B; } } //S[l,r) ull find(Int l,Int r){ return hash[r]-hash[l]*p[r-l]; } }; //INSERT ABOVE HERE signed main(){ string s; cin>>s; Int n=s.size(); { string t(s); t.erase(unique(t.begin(),t.end()),t.end()); if(t.size()==1u){ cout<<n<<endl<<1<<endl; return 0; } } vector<vector<Int> > v(n+1); for(Int i=1;i<=n;i++) for(Int j=i+i;j<=n;j+=i) v[j].emplace_back(i); RollingHash rh1(s); RollingHash2 rh2(s); auto check=[&](Int l,Int r)->Int{ for(Int x:v[r-l]) if(rh1.find(l,r-x)==rh1.find(l+x,r)) return 0; return 1; }; if(check(0,n)){ cout<<1<<endl<<1<<endl; return 0; } //assert(0); assert(check(0,n-1)); cout<<2<<endl; Int ans=0; for(Int i=1;i<n;i++) ans+=check(0,i)&&check(i,n); cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:53:3: error: 'RollingHash2' was not declared in this scope; did you mean 'RollingHash'? 53 | RollingHash2 rh2(s); | ^~~~~~~~~~~~ | RollingHash
s486290999
p04018
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> P; #define fi first #define se second #define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++) #define rep(i,n) repl(i,0,n) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<x<<endl #define mmax(x,y) (x>y?x:y) #define mmin(x,y) (x<y?x:y) #define maxch(x,y) x=mmax(x,y) #define minch(x,y) x=mmin(x,y) #define uni(x) x.erase(unique(all(x)),x.end()) #define exist(x,y) (find(all(x),y)!=x.end()) #define bcnt __builtin_popcount #define INF 1e16 vector<ll> z_algorithm(string S){ const ll n=S.length(); vector<ll> A(n); A[0] = n; int i = 1, j = 0; while (i < n) { while (i+j < n && S[j] == S[i+j]) ++j; A[i] = j; if (j == 0) { ++i; continue;} ll k = 1; while (i+k < n && k+A[k] < j) A[i+k] = A[k], ++k; i += k; j -= k; } return A; } string s; bool g[501010]; int main(){ cin>>s; ll n=s.size(); { bool same=true; rep(i,n-1)if(s[i]!=s[i+1])same=false; if(same){ cout<<n<<endl; cout<<1<<endl; return 0; } } vector<ll> ds; for(ll i=1;i*i<=n;i++){ if(n%i==0){ ds.push_back(i); if(n/i!=i)ds.push_back(n/i); } } sort(all(ds)); ll minc=-1; for(ll len : ds){ set<string> st; for(ll i=0;i<=n-len;i+=len){ st.insert(s.substr(i,len)); } if(st.size()==1){ minc=len; break; } } if(minc==n){ cout<<1<<endl; cout<<1<<endl; return 0; } cout<<2<<endl; vector<ll> z=z_algorithm(s); repl(i,1,n+1)g[i]=true; repl(i,1,n){ for(ll k=2;(k-1)*i<=z[i];k++)g[i*k]=false; } repl(i,1,n+1)if(!g[i])res++; cout<<res<<endl; return 0; }
a.cc: In function 'int main()': a.cc:85:25: error: 'res' was not declared in this scope; did you mean 'rep'? 85 | repl(i,1,n+1)if(!g[i])res++; | ^~~ | rep a.cc:86:9: error: 'res' was not declared in this scope; did you mean 'rep'? 86 | cout<<res<<endl; | ^~~ | rep
s270831382
p04018
C++
#include <bits/stdc++.h> #define MOD 1000000007LL using namespace std; typedef long long ll; typedef pair<int,int> P; string str; int dp[4001]; ll pat[4001]; ll tx[4001]; ll hash[4001]; bool C(int f,int t){ int len=t-f; vector<int> ve; for(int g=2;g*g<=len;g++){ if(len%g==0){ ve.push_back(g); ve.push_back(len/g); } } for(int i=0;i<ve.size();i++){ int v=ve[i]; ll base=(hash[f+v]-hash[f]+MOD)%MOD; int j; for(j=1;j<len/v;j++){ ll bak=(hash[f+v*(j+1)]-hash[f+v*j]+MOD)%MOD; if(base*tx[v*j]%MOD!=bak)break; } if(j==len/v)return false; } return true; } int main(void){ cin >> str; int n=str.size(); tx[0]=1; for(int i=0;i<n;i++){ hash[i+1]+=hash[i]; hash[i+1]+=(str[i]-'a')*tx[i]%MOD; hash[i+1]%=MOD; tx[i+1]=tx[i]*26LL%MOD; } pat[0]=1; for(int i=0;i<=n;i++){ dp[i]=n+5; } dp[0]=0; for(int i=0;i<n;i++){ for(int j=i+1;j<=n;j++){ if(C(i,j)){ if(dp[j]>dp[i]+1){ pat[j]=0; } dp[j]=min(dp[j],dp[i]+1); if(dp[j]==(dp[i]+1)){ pat[j]+=pat[i]; pat[j]%=MOD; } } } } printf("%d\n",dp[n]); printf("%lld\n",pat[n]); return 0; }
a.cc: In function 'bool C(int, int)': a.cc:24:26: error: reference to 'hash' is ambiguous 24 | ll base=(hash[f+v]-hash[f]+MOD)%MOD; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~ a.cc:24:36: error: reference to 'hash' is ambiguous 24 | ll base=(hash[f+v]-hash[f]+MOD)%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~ a.cc:27:33: error: reference to 'hash' is ambiguous 27 | ll bak=(hash[f+v*(j+1)]-hash[f+v*j]+MOD)%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~ a.cc:27:49: error: reference to 'hash' is ambiguous 27 | ll bak=(hash[f+v*(j+1)]-hash[f+v*j]+MOD)%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~ a.cc: In function 'int main()': a.cc:40:17: error: reference to 'hash' is ambiguous 40 | hash[i+1]+=hash[i]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~ a.cc:40:28: error: reference to 'hash' is ambiguous 40 | hash[i+1]+=hash[i]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~ a.cc:41:17: error: reference to 'hash' is ambiguous 41 | hash[i+1]+=(str[i]-'a')*tx[i]%MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~ a.cc:42:17: error: reference to 'hash' is ambiguous 42 | hash[i+1]%=MOD; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:11:4: note: 'll hash [4001]' 11 | ll hash[4001]; | ^~~~
s682109631
p04018
C++
import java.io.*; import java.util.*; import java.math.*; // import java.awt.Point; public class Main { InputStream is; PrintWriter out; String INPUT = ""; long mod = 1_000_000_007; long inf = Long.MAX_VALUE; void solve(){ String s = ns(); int[] z = zalgo(s); int f = 0; int sub = -1; for(int i = 1; i < z.length; i++){ // out.println(z[i]); if(z[i]==z.length-i){ sub = i-f; if((z.length-i)%sub!=0){ out.println(1); out.println(1); return; } else break; } } if(sub==-1){ out.println(1); out.println(1); return; } if(sub==1){ out.println(z.length); out.println(1); return; } int ans = z.length-z.length/sub; if(2*sub==z.length) ans++; out.println(2); out.println(ans); } int[] zalgo(String s) { int n = s.length(); int[] ret = new int[n]; ret[0] = n; int i = 1, j = 0; while (i < n) { while (i + j < n && s.charAt(j) == s.charAt(i + j)) ++j; ret[i] = j; if (j == 0) { ++i; continue; } int k = 1; while (i + k < n && k + ret[k] < j) { ret[i + k] = ret[k]; ++k; } i += k; j -= k; } return ret; } void run() throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms"); } public static void main(String[] args) throws Exception { new Main().run(); } private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; private int readByte() { if(lenbuf == -1)throw new InputMismatchException(); if(ptrbuf >= lenbuf){ ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!(isSpaceChar(b) && b != ' ')){ sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while(p < n && !(isSpaceChar(b))){ buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m) { char[][] map = new char[n][]; for(int i = 0;i < n;i++)map[i] = ns(m); return map; } private int[] na(int n) { int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = ni(); return a; } private int ni() { int num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private long nl() { long num = 0; int b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.math.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: expected unqualified-id before 'public' 6 | public class Main { | ^~~~~~
s813142705
p04018
C++
import java.io.*; import java.util.*; import java.math.*; // import java.awt.Point; public class Main { InputStream is; PrintWriter out; String INPUT = ""; long mod = 1_000_000_007; long inf = Long.MAX_VALUE; void solve(){ String s = ns(); int[] z = zalgo(s); int f = 0; int sub = -1; for(int i = 1; i < z.length; i++){ // out.println(z[i]); if(z[i]==z.length-i){ sub = i-f; if((z.length-i)%sub!=0){ out.println(1); out.println(1); return; } else break; } } if(sub==-1){ out.println(1); out.println(1); return; } if(sub==1){ out.println(z.length); out.println(1); return; } int ans = z.length-z.length/sub; if(2*sub==z.length) ans++; out.println(2); out.println(ans); } int[] zalgo(String s) { int n = s.length(); int[] ret = new int[n]; ret[0] = n; int i = 1, j = 0; while (i < n) { while (i + j < n && s.charAt(j) == s.charAt(i + j)) ++j; ret[i] = j; if (j == 0) { ++i; continue; } int k = 1; while (i + k < n && k + ret[k] < j) { ret[i + k] = ret[k]; ++k; } i += k; j -= k; } return ret; } void run() throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms"); } public static void main(String[] args) throws Exception { new Main().run(); } private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; private int readByte() { if(lenbuf == -1)throw new InputMismatchException(); if(ptrbuf >= lenbuf){ ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!(isSpaceChar(b) && b != ' ')){ sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while(p < n && !(isSpaceChar(b))){ buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m) { char[][] map = new char[n][]; for(int i = 0;i < n;i++)map[i] = ns(m); return map; } private int[] na(int n) { int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = ni(); return a; } private int ni() { int num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private long nl() { long num = 0; int b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.math.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: expected unqualified-id before 'public' 6 | public class Main { | ^~~~~~
s198341671
p04018
C++
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(x,y) (x=min(x,y)) #define chmax(x,y) (x=max(x,y)) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 500010 int c[2][N]; int n; string s; void ZAlgo(string &s, vector<int> &z){ int n = s.size(); z = vector<int>(n); z[0] = n; int i = 1, j = 0; while(i < n){ while(i+j < n && s[j]==s[i+j]) j++; z[i] = j; if(j==0){ i++; continue; } int k = 1; while(i+k < n && k+a[k]<j) z[i+k] = z[k], k++; i += k; j -= k; } } int main(){ cin>>s; n = s.size(); rep(k, 2){ vector<int> z; ZAlgo(s, z); for(int i = 1; i <= n/2; i++){ if(c[i]) continue; for(int j = 2*i; j <= n; j+=i){ if(z[j-i]>=i) c[k][j] = 1; else break; } } reverse(all(s)); } reverse(c[1], c[1]+n+1); if(!c[n]){ cout<<1<<endl; cout<<1<<endl; } else if(s==string(n, s[0])){ cout<<n<<endl; cout<<1<<endl; } else { cout<<2<<endl; int sum = 0; for(int i = 0; i <= n; i++) if(!c[i]&&!c2[i]) sum++; cout<<sum<<endl; //for(int i = 0; i <= n; i++) cout<<c[i]<<" "<<c2[i]<<endl; } return 0; }
a.cc: In function 'void ZAlgo(std::string&, std::vector<int>&)': a.cc:59:36: error: 'a' was not declared in this scope 59 | while(i+k < n && k+a[k]<j) z[i+k] = z[k], k++; | ^ a.cc: In function 'int main()': a.cc:92:56: error: 'c2' was not declared in this scope; did you mean 'c'? 92 | for(int i = 0; i <= n; i++) if(!c[i]&&!c2[i]) sum++; | ^~ | c
s134426204
p04018
C++
#include <algorithm> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(x,y) (x=min(x,y)) #define chmax(x,y) (x=max(x,y)) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 500010 int c[2][N]; int n; string s; void ZAlgo(string &s, vector<int> &z){ int n = s.size(); z = vector<int>(n); z[0] = n; int i = 1, j = 0; while(i < n){ while(i+j < n && s[j]==s[i+j]) j++; a[i] = j; if(j==0){ i++; continue; } int k = 1; while(i+k < n && k+a[k]<j) z[i+k] = z[k], k++; i += k; j -= k; } } int main(){ cin>>s; n = s.size(); rep(k, 2){ vector<int> z; ZAlgo(s, z); for(int i = 1; i <= n/2; i++){ if(c[i]) continue; for(int j = 2*i; j <= n; j+=i){ if(z[j-i]>=i) c[k][j] = 1; else break; } } reverse(all(s)); } reverse(c[1], c[1]+n+1); if(!c[n]){ cout<<1<<endl; cout<<1<<endl; } else if(s==string(n, s[0])){ cout<<n<<endl; cout<<1<<endl; } else { cout<<2<<endl; int sum = 0; for(int i = 0; i <= n; i++) if(!c[i]&&!c2[i]) sum++; cout<<sum<<endl; //for(int i = 0; i <= n; i++) cout<<c[i]<<" "<<c2[i]<<endl; } return 0; }
a.cc: In function 'void ZAlgo(std::string&, std::vector<int>&)': a.cc:53:17: error: 'a' was not declared in this scope 53 | a[i] = j; | ^ a.cc: In function 'int main()': a.cc:92:56: error: 'c2' was not declared in this scope; did you mean 'c'? 92 | for(int i = 0; i <= n; i++) if(!c[i]&&!c2[i]) sum++; | ^~ | c
s288700394
p04018
C++
#include <iostream> #include <cstdio> #include <cstring> using namespace std; const int MAXN = 5e5 + 10; char s[MAXN]; int next[MAXN] , l; bool f[MAXN] , e[MAXN]; int main(){ memset(f , 0 , sizeof f); cin >> s + 1; l = strlen(s + 1); bool same = 1; for(int i = 2 ; i <= l ; ++ i) if(s[i] != s[1]){ same = 0; break; } if(same){ cout << l << endl << 1 << endl; return 0; } next[1] = 0; for(int i = 2 ; i <= l ; ++ i){ int tmp = next[i - 1]; while(tmp && s[tmp + 1] != s[i]) tmp = next[tmp]; if(s[tmp + 1] == s[i]) tmp ++; next[i] = tmp; int ll = i - next[i]; if(next[i] && i % ll == 0) f[i] = 1; } next[l] = 0; for(int i = l - 1 ; i >= 1 ; -- i){ int tmp = next[i + 1]; while(tmp && s[l - tmp] != s[i]) tmp = next[l - tmp + 1]; if(s[l - tmp] == s[i]) tmp ++; next[i] = tmp; int ll = l - i + 1 - next[i]; if(next[i] && (l - i + 1) % ll == 0) e[i] = 1; } if(!f[l]){ cout << 1 << endl << 1 << endl; return 0; } int ans = 0; for(int i = 1 ; i < l ; ++ i) if(!f[i] && !e[i + 1]) ans ++; cout << 2 << endl << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:9: error: reference to 'next' is ambiguous 25 | next[1] = 0; | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:27:27: error: reference to 'next' is ambiguous 27 | int tmp = next[i - 1]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:29:31: error: reference to 'next' is ambiguous 29 | tmp = next[tmp]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:32:17: error: reference to 'next' is ambiguous 32 | next[i] = tmp; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:33:30: error: reference to 'next' is ambiguous 33 | int ll = i - next[i]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:34:20: error: reference to 'next' is ambiguous 34 | if(next[i] && i % ll == 0) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:37:9: error: reference to 'next' is ambiguous 37 | next[l] = 0; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:39:27: error: reference to 'next' is ambiguous 39 | int tmp = next[i + 1]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:41:31: error: reference to 'next' is ambiguous 41 | tmp = next[l - tmp + 1]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:44:17: error: reference to 'next' is ambiguous 44 | next[i] = tmp; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:45:38: error: reference to 'next' is ambiguous 45 | int ll = l - i + 1 - next[i]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~ a.cc:46:20: error: reference to 'next' is ambiguous 46 | if(next[i] && (l - i + 1) % ll == 0) | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [500010]' 9 | int next[MAXN] , l; | ^~~~
s508065744
p04018
C++
#include <iostream> #include <cstdio> #include <cstring> using namespace std; const int MAXN = 1e5 + 10; char s[MAXN]; int next[MAXN]; int main(){ cin >> s + 1; int l = strlen(s + 1); bool ok = 1; for(int i = 1 ; i <= l ; ++ i) if(s[i] != s[1]){ ok = 0; break; } if(ok){ cout << l << endl << 1 << endl; return 0; } next[1] = 0; int len = 0; for(int i = 2 ; i <= l ; ++ i){ while(len && s[len + 1] != s[i]) len = next[len]; if(s[len + 1] == s[i]) len ++; next[i] = len; } int t = l - len; if(len != 0 && l % t == 0){ cout << 2 << endl; if(l / t == 2) cout << l - 1 << endl; else cout << l - (l / t) << endl; } else cout << 1 << endl << 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:9: error: reference to 'next' is ambiguous 23 | next[1] = 0; | ^~~~ In file included from /usr/include/c++/14/string:47, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [100010]' 9 | int next[MAXN]; | ^~~~ a.cc:27:31: error: reference to 'next' is ambiguous 27 | len = next[len]; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [100010]' 9 | int next[MAXN]; | ^~~~ a.cc:30:17: error: reference to 'next' is ambiguous 30 | next[i] = len; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:9:5: note: 'int next [100010]' 9 | int next[MAXN]; | ^~~~
s664069377
p04018
C++
#include <bits/stdc++.h> #define ll long long #define uint unsignextd long long #define db double #define ls x << 1 #define rs x << 1 | 1 #define pb push_back #define mp make_pair #define pii pair<int, int> #define X first #define Y second #define pcc pair<char, char> #define vi vector<int> #define vl vector<ll> #define rep(i, x, y) for(int i = x; i <= y; i ++) #define rrep(i, x, y) for(int i = x; i >= y; i --) #define eps 1e-9 using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } const int N = 500010 , mod = 1e9 + 7; int n, next[N], next2[N]; char s[N]; bool is(int x, int *next) { return next[x] && x % (x - next[x]) == 0; } int main() { scanf("%s",s + 1); n = strlen(s + 1); int j = 0; rep(i, 2, n) { while(j && s[j + 1] != s[i]) j = next[j]; next[i] = s[j + 1] == s[i] ? ++ j : j; } if(!is(n, next)) printf("1\n1\n"); else if(next[n] == n - 1) printf("%d\n1\n",n); else { reverse(s + 1, s + 1 + n); j = 0; rep(i, 2, n) { while(j && s[j + 1] != s[i]) j = next2[j]; next2[i] = (s[j + 1] == s[i] ? ++ j : j); } int ans = 0; rep(i, 1, n - 1) if(!is(i, next) && !is(n - i, next2)) ans ++; printf("2\n%d\n", ans); } return 0; }
a.cc: In function 'int main()': a.cc:41:42: error: reference to 'next' is ambiguous 41 | while(j && s[j + 1] != s[i]) j = next[j]; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:27:8: note: 'int next [500010]' 27 | int n, next[N], next2[N]; | ^~~~ a.cc:42:9: error: reference to 'next' is ambiguous 42 | next[i] = s[j + 1] == s[i] ? ++ j : j; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:27:8: note: 'int next [500010]' 27 | int n, next[N], next2[N]; | ^~~~ a.cc:44:15: error: reference to 'next' is ambiguous 44 | if(!is(n, next)) printf("1\n1\n"); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:27:8: note: 'int next [500010]' 27 | int n, next[N], next2[N]; | ^~~~ a.cc:45:13: error: reference to 'next' is ambiguous 45 | else if(next[n] == n - 1) printf("%d\n1\n",n); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:27:8: note: 'int next [500010]' 27 | int n, next[N], next2[N]; | ^~~~ a.cc:57:27: error: reference to 'next' is ambiguous 57 | if(!is(i, next) && !is(n - i, next2)) ans ++; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:27:8: note: 'int next [500010]' 27 | int n, next[N], next2[N]; | ^~~~
s195556715
p04018
C++
for(int i=1;i<=sz/2;i++){ if(!bad1[i]){ string tmp=str.substr(0,i); int j=i; while( j+i<=sz ){ if(tmp==str.substr(j,i)){ bad1[j+i]=true; j+=i; }else{ break; } } } }
a.cc:1:1: error: expected unqualified-id before 'for' 1 | for(int i=1;i<=sz/2;i++){ | ^~~ a.cc:1:13: error: 'i' does not name a type 1 | for(int i=1;i<=sz/2;i++){ | ^ a.cc:1:21: error: 'i' does not name a type 1 | for(int i=1;i<=sz/2;i++){ | ^
s749669925
p04018
C++
#include<iostream> #include<vector> #include<string> using namespace std; int main(){ string str; cin>>str; char aho=str[0]; bool flag=true; for(int i=0;i<str.size();i++){ if(str[i]!=aho){ flag=false; break; } } if(flag){//みんな同じ文字 cout<<str.size()<<endl; cout<<1<<endl; }else{ //先ずはstr.size()のすべての約数を求める。 int sz=str.size(); vector<int> div; for(int i=2;i<=sz;i++){ if(sz%i==0){ div.push_back(i); } } int syuuki; for(int i=0;i<div.size();i++){//div[i]個の文字からなる周期を持つのかチェックする。 string tmp=str.substr(0,div[i]); int j=0; bool fla=true; while(j+div[i]<=sz){ string hikaku=str.substr(j,div[i]); if(tmp!=hikaku){ fla=false; break; } j+=div[i]; } if(fla){ syuuki=div[i]; break; } } if(syuuki==sz){ cout<<1<<endl; cout<<1<<endl; }else{ cout<<2<<endl; bool bad1[250001]={}; string nex=str.substr(0,syuuki); int nn=nex.size(); for(int i=1;i<=nn/2;i++){ if(!bad1[2*i]){ string tmp=nex.substr(0,i); int j=i; while( tmp==nex.substr(j,i) ){ bad1[j+i]=true; j+=i; if(j+i>nex.size()) break; } } } reverse(nex.begin(),nex.end()); bool bad2[250001]={}; for(int i=1;i<=nn/2;i++){ if(!bad2[2*i]){ string tmp=nex.substr(0,i); int j=i; while( tmp==nex.substr(j,i) ){ bad2[j+i]=true; j+=i; if(j+i>nex.size()) break; } } } int res=sz-1; for(int i=1;i<nn;i++){ if(bad1[i]) res--; } for(int i=1;i<nn;i++){ if(bad2[i]) res--; } if(syuuki!=2){ res -= (sz/syuuki-1); } cout<<res<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:66:13: error: 'reverse' was not declared in this scope 66 | reverse(nex.begin(),nex.end()); | ^~~~~~~
s406945895
p04018
Java
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; public static void main(String[] args) throws Exception { new Main().run(); } long mod = 1000000007; void solver() { String w = ns(); boolean all = true; for (int i = 1; i < w.length(); i++) { if (w.charAt(i) != w.charAt(i - 1)) { all = false; break; } } if (all) { out.println(w.length() + "\n" + 1); return; } int n = w.length(); long b = 29; long[] mod = { 1000000007, 1000000009 }; long[][] hash = new long[2][n]; long[][] pow = new long[2][n]; for (int i = 0; i < 2; i++) { for (int j = 0; j < n; j++) { if (j == 0) pow[i][j] = 1; else { pow[i][j] = pow[i][j - 1] * b; if (pow[i][j] >= mod[i]) pow[i][j] %= mod[i]; } } } System.out.println("!"); for (int i = 0; i < 2; i++) { for (int j = n - 1; j >= 0; j--) { hash[i][j] = (w.charAt(j) - 'a') + (j == n - 1 ? 0 : hash[i][j + 1] * b); if (hash[i][j] >= mod[i]) hash[i][j] %= mod[i]; } } ArrayList<Integer>[] div = new ArrayList[n + 1]; for (int i = 0; i <= n; i++) div[i] = new ArrayList<>(); for (int i = 2; i < n; i++) { for (int j = 2 * i; j <= n; j += i) { div[j].add(i); } } for (int i = 0; i < 2; i++) { if (isGood(0, n, hash[i], mod[i], pow[i], div)) { out.println("1\n1"); return; } } int ret = 0; for (int i = 1; i < n; i++) { boolean f = true; for (int j = 0; j < 2; j++) { if (!isGood(0, i, hash[j], mod[j], pow[j], div[i - 0]) || !isGood(i, n, hash[j], mod[j], pow[j], div[n - i])) { f = false; break; } } if (f) { ret++; } } out.println(2 + "\n" + ret); } boolean isGood(int s, int t, long[] hash, long mod, long[] pow, ArrayList<Integer> div) { for (int period : div) { long v1 = (hash[s] - hash[t - period] % mod * pow[t - period] % mod + mod) % mod; long v2 = (hash[s + period] - (t == hash.length ? 0 : hash[t]) % mod * pow[t] % mod + mod) % mod; if (v1 == v2) return false; } return true; } void run() { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); solver(); out.flush(); } static long nl() { try { long num = 0; boolean minus = false; while ((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-')) ; if (num == '-') { num = 0; minus = true; } else { num -= '0'; } while (true) { int b = is.read(); if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } } } catch (IOException e) { } return -1; } static char nc() { try { int b = skip(); if (b == -1) return 0; return (char) b; } catch (IOException e) { } return 0; } static double nd() { try { return Double.parseDouble(ns()); } catch (Exception e) { } return 0; } static String ns() { try { int b = skip(); StringBuilder sb = new StringBuilder(); if (b == -1) return ""; sb.append((char) b); while (true) { b = is.read(); if (b == -1) return sb.toString(); if (b <= ' ') return sb.toString(); sb.append((char) b); } } catch (IOException e) { } return ""; } public static char[] ns(int n) { char[] buf = new char[n]; try { int b = skip(), p = 0; if (b == -1) return null; buf[p++] = (char) b; while (p < n) { b = is.read(); if (b == -1 || b <= ' ') break; buf[p++] = (char) b; } return Arrays.copyOf(buf, p); } catch (IOException e) { } return null; } public static byte[] nse(int n) { byte[] buf = new byte[n]; try { int b = skip(); if (b == -1) return null; is.read(buf); return buf; } catch (IOException e) { } return null; } static int skip() throws IOException { int b; while ((b = is.read()) != -1 && !(b >= 33 && b <= 126)) ; return b; } static boolean eof() { try { is.mark(1000); int b = skip(); is.reset(); return b == -1; } catch (IOException e) { return true; } } static int ni() { try { int num = 0; boolean minus = false; while ((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-')) ; if (num == '-') { num = 0; minus = true; } else { num -= '0'; } while (true) { int b = is.read(); if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } } } catch (IOException e) { } return -1; } static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
Main.java:66: error: incompatible types: ArrayList<Integer>[] cannot be converted to ArrayList<Integer> if (isGood(0, n, hash[i], mod[i], pow[i], div)) { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s772005099
p04018
Java
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; public class Main { static InputStream is; static PrintWriter out; static String INPUT = ""; public static void main(String[] args) throws Exception { new Main().run(); } long mod = 1000000007; void solver() { String w = ns(); boolean all = true; for (int i = 1; i < w.length(); i++) { if (w.charAt(i) != w.charAt(i - 1)) { all = false; break; } } if (all) { out.println(w.length() + "\n" + 1); return; } int n = w.length(); long b = 29; long[] mod = { 1000000007, 1000000009 }; long[][] hash = new long[2][n]; long[][] pow = new long[2][n]; for (int i = 0; i < 2; i++) { for (int j = 0; j < n; j++) { if (j == 0) pow[i][j] = 1; else { pow[i][j] = pow[i][j - 1] * b; if (pow[i][j] >= mod[i]) pow[i][j] %= mod[i]; } } } System.out.println("!"); for (int i = 0; i < 2; i++) { for (int j = n - 1; j >= 0; j--) { hash[i][j] = (w.charAt(j) - 'a') + (j == n - 1 ? 0 : hash[i][j + 1] * b); if (hash[i][j] >= mod[i]) hash[i][j] %= mod[i]; } } ArrayList<Integer>[] div = new ArrayList[n + 1]; for (int i = 0; i <= n; i++) div[i] = new ArrayList<>(); for (int i = 2; i < n; i++) { for (int j = 2 * i; j <= n; j += i) { div[j].add(i); } } for (int i = 0; i < 2; i++) { if (isGood(0, n, hash[i], mod[i], pow[i], div)) { out.println("1\n1"); return; } } int ret = 0; for (int i = 1; i < n; i++) { boolean f = true; for (int j = 0; j < 2; j++) { if (!isGood(0, i, hash[j], mod[j], pow[j], div[i - 0]) || !isGood(i, n, hash[j], mod[j], pow[j], div[n - i])) { f = false; break; } } if (f) { ret++; } } out.println(2 + "\n" + ret); } boolean isGood(int s, int t, long[] hash, long mod, long[] pow, ArrayList<Integer> div) { for (int period : div) { long v1 = (hash[s] - hash[t - period] % mod * pow[t - period] % mod + mod) % mod; long v2 = (hash[s + period] - (t == hash.length ? 0 : hash[t]) % mod * pow[t] % mod + mod) % mod; if (v1 == v2) return false; } return true; } void run() { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); solver(); out.flush(); } static long nl() { try { long num = 0; boolean minus = false; while ((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-')) ; if (num == '-') { num = 0; minus = true; } else { num -= '0'; } while (true) { int b = is.read(); if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } } } catch (IOException e) { } return -1; } static char nc() { try { int b = skip(); if (b == -1) return 0; return (char) b; } catch (IOException e) { } return 0; } static double nd() { try { return Double.parseDouble(ns()); } catch (Exception e) { } return 0; } static String ns() { try { int b = skip(); StringBuilder sb = new StringBuilder(); if (b == -1) return ""; sb.append((char) b); while (true) { b = is.read(); if (b == -1) return sb.toString(); if (b <= ' ') return sb.toString(); sb.append((char) b); } } catch (IOException e) { } return ""; } public static char[] ns(int n) { char[] buf = new char[n]; try { int b = skip(), p = 0; if (b == -1) return null; buf[p++] = (char) b; while (p < n) { b = is.read(); if (b == -1 || b <= ' ') break; buf[p++] = (char) b; } return Arrays.copyOf(buf, p); } catch (IOException e) { } return null; } public static byte[] nse(int n) { byte[] buf = new byte[n]; try { int b = skip(); if (b == -1) return null; is.read(buf); return buf; } catch (IOException e) { } return null; } static int skip() throws IOException { int b; while ((b = is.read()) != -1 && !(b >= 33 && b <= 126)) ; return b; } static boolean eof() { try { is.mark(1000); int b = skip(); is.reset(); return b == -1; } catch (IOException e) { return true; } } static int ni() { try { int num = 0; boolean minus = false; while ((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-')) ; if (num == '-') { num = 0; minus = true; } else { num -= '0'; } while (true) { int b = is.read(); if (b >= '0' && b <= '9') { num = num * 10 + (b - '0'); } else { return minus ? -num : num; } } } catch (IOException e) { } return -1; } static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
Main.java:66: error: incompatible types: ArrayList<Integer>[] cannot be converted to ArrayList<Integer> if (isGood(0, n, hash[i], mod[i], pow[i], div)) { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s616511638
p04018
C++
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <cstdlib> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> //#pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; #define ll long long #define SZ(x) ((int)(x).size()) #define ALL(v) (v).begin(), (v).end() #define foreach(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i) #define reveach(i, v) for (__typeof((v).rbegin()) i = (v).rbegin(); i != (v).rend(); ++ i) #define REP(i,a,n) for ( int i=a; i<int(n); i++ ) #define FOR(i,a,n) for ( int i=n-1; i>= int(a);i-- ) #define lson rt<<1, L, m #define rson rt<<1|1, m, R typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define mp(x, y) make_pair(x, y) #define pb(x) push_back(x) #define fi first #define se second #define CLR(a, b) memset(a, b, sizeof(a)) #define Max(a, b) a = max(a, b) #define Min(a, b) a = min(a, b) const int MAXN=500000 + 7; const int MOD = 1e9 + 7; int t1[MAXN],t2[MAXN],c[MAXN];//求SA数组需要的中间变量,不需要赋值 //待排序的字符串放在s数组中,从s[0]到s[n-1],长度为n,且最大值小于m, //除s[n-1]外的所有s[i]都大于0,r[n-1]=0 //函数结束以后结果放在sa数组中 bool cmp(int *r,int a,int b,int l) { return r[a] == r[b] && r[a+l] == r[b+l]; } void da(int str[],int sa[],int rank[],int height[],int n,int m) { n++; int i, j, p, *x = t1, *y = t2; //第一轮基数排序,如果s的最大值很大,可改为快速排序 for(i = 0;i < m;i++)c[i] = 0; for(i = 0;i < n;i++)c[x[i] = str[i]]++; for(i = 1;i < m;i++)c[i] += c[i-1]; for(i = n-1;i >= 0;i--)sa[--c[x[i]]] = i; for(j = 1;j <= n; j <<= 1) { p = 0; //直接利用sa数组排序第二关键字 for(i = n-j; i < n; i++)y[p++] = i;//后面的j个数第二关键字为空的最小 for(i = 0; i < n; i++)if(sa[i] >= j)y[p++] = sa[i] - j; //这样数组y保存的就是按照第二关键字排序的结果 //基数排序第一关键字 for(i = 0; i < m; i++)c[i] = 0; for(i = 0; i < n; i++)c[x[y[i]]]++; for(i = 1; i < m;i++)c[i] += c[i-1]; for(i = n-1; i >= 0;i--)sa[--c[x[y[i]]]] = y[i]; //根据sa和x数组计算新的x数组 swap(x,y); p = 1; x[sa[0]] = 0; for(i = 1;i < n;i++) x[sa[i]] = cmp(y,sa[i-1],sa[i],j)?p-1:p++; if(p >= n)break; m = p;//下次基数排序的最大值 } int k = 0; n--; for(i = 0;i <= n;i++)rank[sa[i]] = i; for(i = 0;i < n;i++) { if(k)k--; j = sa[rank[i]-1]; while(str[i+k] == str[j+k])k++; height[rank[i]] = k; } } int rank[MAXN],height[MAXN]; int RMQ[MAXN]; int mm[MAXN]; int best[20][MAXN]; void initRMQ(int n) { mm[0]=-1; for(int i=1;i<=n;i++) mm[i]=((i&(i-1))==0)?mm[i-1]+1:mm[i-1]; for(int i=1;i<=n;i++)best[0][i]=i; for(int i=1;i<=mm[n];i++) for(int j=1;j+(1<<i)-1<=n;j++) { int a=best[i-1][j]; int b=best[i-1][j+(1<<(i-1))]; if(RMQ[a]<RMQ[b])best[i][j]=a; else best[i][j]=b; } } int askRMQ(int a,int b) { if(a > b) swap(b); int t; t=mm[b-a+1]; b-=(1<<t)-1; a=best[t][a];b=best[t][b]; return RMQ[a]<RMQ[b]?a:b; } int lcp(int a,int b) { a= :: rank[a];b= :: rank[b]; if(a>b)swap(a,b); return height[askRMQ(a+1,b)]; } char str[MAXN]; int r[MAXN]; int sa[MAXN]; int n; bool equ(){ if(n == 1) return true; REP(i, 1, n) if(r[i] != r[i - 1]) return false; return true; } bool one(){ int len = n + 1; REP(i, :: rank[0] + 1, n + 1){ Min(len, height[i]); if(len == n - sa[i] && len % sa[i] == 0){ return false; } } len = n + 1; FOR(i, 2, :: rank[0] + 1){ Min(len, height[i]); if(len == n - sa[i - 1] && len % sa[i - 1] == 0){ return false; } } return true; } int pre[MAXN], suf[MAXN]; int main(){ #ifdef ac freopen("in.txt","r",stdin); #endif //freopen("out.txt","w",stdout); scanf("%s", str); n = strlen(str); REP(i, 0, n) r[i] = str[i]; r[n] = 0; da(r, sa, :: rank, height, n, 128); REP(i, 1, n + 1) RMQ[i] = height[i]; initRMQ(n); if(equ()){ printf("%d\n%d\n", n, 1); return 0; } //REP(i, 1, n + 1) printf("i = %d, sa[i] = %d\n", i, sa[i]); if(one()){ puts("1\n1"); return 0; } puts("2"); pre[1] = 1; REP(len, 2, n){ } return 0; }
a.cc: In function 'int askRMQ(int, int)': a.cc:88:19: error: no matching function for call to 'swap(int&)' 88 | if(a > b) swap(b); | ~~~~^~~ In file included from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'template<class _Tp> std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)' 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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: /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' 1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted) 1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/string:54: /usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate expects 2 arguments, 1 provided 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:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' 2805 | swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) | ^~~~ /usr/include/c++/14/tuple:2805:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/tuple:2823:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<(! std::__and_<std::__is_swappable<_Elements>...>::value)>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' (deleted) 2823 | swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete; | ^~~~ /usr/include/c++/14/tuple:2823:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/vector:66, from a.cc:8: /usr/include/c++/14/bits/stl_vector.h:2122:5: note: candidate: 'template<class _Tp, class _Alloc> void std::swap(vector<_Tp, _Alloc>&, vector<_Tp, _Alloc>&)' 2122 | swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) | ^~~~ /usr/include/c++/14/bits/stl_vector.h:2122:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/deque:66, from /usr/include/c++/14/queue:62, from a.cc:9: /usr/include/c++/14/bits/stl_deque.h:2370:5: note: candidate: 'template<class _Tp, class _Alloc> void std::swap(deque<_Tp, _Alloc>&, deque<_Tp, _Alloc>&)' 2370 | swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) | ^~~~ /usr/include/c++/14/bits/stl_deque.h:2370:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/queue:66: /usr/include/c++/14/bits/stl_queue.h:445:5: note: candidate: 'template<class _Tp, class _Seq> typename std::enable_if<std::__is_swappable<_T2>::value>::type std::swap(queue<_Tp, _Seq>&, queue<_Tp, _Seq>&)' 445 | swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:445:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_queue.h:834:5: note: candidate: 'template<class _Tp, class _Sequence, class _Compare> typename std::enable_if<std::__and_<std::__is_swappable<_T2>, std::__is_swappable<_Compare> >::value>::type std::swap(priority_queue<_Tp, _Sequence, _Compare>&, priority_queue<_Tp, _Sequence, _Compare>&)' 834 | swap(priority_queue<_Tp, _Sequence, _Compare>& __x, | ^~~~ /usr/include/c++/14/bits/stl_queue.h:834:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/stack:63, from a.cc:10: /usr/include/c++/14/bits/stl_stack.h:421:5: note: candidate: 'template<class _Tp, class _Seq> typename std::enable_if<std::__is_swappable<_T2>::value>::type std::swap(stack<_Tp, _Seq>&, stack<_Tp, _Seq>&)' 421 | swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y) | ^~~~ /usr/include/c++/14/bits/stl_stack.h:421:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/set:62, from a.cc:11: /usr/include/c++/14/bits/stl_tree.h:1675:5: note: candidate: 'template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> void std::swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)' 1675 | swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, | ^~~~ /usr/include/c++/14/bits/stl_tree.h:1675:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/set:63: /usr/include/c++/14/bits/stl_set.h:1061:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> void std::swap(set<_Key, _Compare, _Allocator>&, set<_Key, _Compare, _Allocator>&)' 1061 | swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y) | ^~~~ /usr/include/c++/14/bits/stl_set.h:1061:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/set:64: /usr/include/c++/14/bits/stl_multiset.h:1047:5: note: candidate: 'template<class _Key, class _Compare, class _Alloc> void std::swap(multiset<_Key, _Compare, _Allocator>&, multiset<_Key, _Compare, _Allocator>&)' 1047 | swap(multiset<_Key, _Compare, _Alloc>& __x, | ^~~~ /usr/include/c++/14/bits/stl_multiset.h:1047:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/map:63, from a.cc:12: /usr/include/c++/14/bits/stl_map.h:1586:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> void std::swap(map<_Key, _Tp, _Compare, _Allocator>&, map<_Key, _Tp, _Compare, _Allocator>&)' 1586 | swap(map<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~ /usr/include/c++/14/bits/stl_map.h:1586:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/14/map:64: /usr/include/c++/14/bits/stl_multimap.h:1208:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> void std::swap(multimap<_Key, _Tp, _Compare, _Allocator>&, multimap<_Key, _Tp, _Compare, _Allocator>&)' 1208 | swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x, | ^~~~ /usr/include/c++/14/bits/stl_multimap.h:1208:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:5: note: candidate expects 2 arguments, 1 provided
s819668883
p04018
C++
#include <map> #include <vector> #include <functional> #include <iterator> #include <utility> #include <array> #include <cstdio> namespace XX { template<template<typename> class Compare, typename T> inline T& UP(T& x, const T& y){if(Compare<T>()(y, x)) x = y; return x;} template<typename Compare, typename T> inline T& UP(T& x, const T& y, Compare comp){if(comp(y, x)) x = y; return x;} template<typename T> inline T& GT(T& x, const T& y){return UP<std::greater>(x, y);} template<typename T> inline T& LS(T& x, const T& y){return UP<std::less>(x, y);} template<typename T> struct Mapper { int operator[](const T& v) { int& ret = table[v]; if(!ret) rtable[ret = table.size()] = v; return ret - 1; } template<typename... Args> int operator()(Args... args) { return (*this)[T(args...)]; } T rev(int idx){return rtable[idx + 1];} std::map<T, int> table; std::map<int, T> rtable; }; template<typename T, int S> struct ReferenceArray { struct It {typename std::array<T*, S>::iterator it; T& operator*(){return **it;} void operator++(){it++;} bool operator!=(const It& other){return it != other.it;} }; int size()const{return _ptr.size();} It begin()const{return {_ptr.begin()};} It end()const{return {_ptr.end()};} T& operator[](int idx)const{return *_ptr[idx];} mutable std::array<T*, S> _ptr; }; template<typename T, typename... Args> ReferenceArray<T, sizeof...(Args) + 1> MAKEV(T& arg1, Args&... args) {return {&arg1, &args...};} struct Range { struct It { int num, step; int operator*(){return num;} void operator++(){num += step;} bool operator!=(const It& other){return num != other.num;} }; Range(int ee):b(0),e(ee){} Range(int bb, int ee):b(bb), e(ee){} It begin(){return {b, (b < e? 1: -1)};} It end(){return {e, 0};} int b, e; }; } template<typename T> struct ScanfSpecifier{}; #define DEF(T,V) template<> struct ScanfSpecifier<T>{static constexpr const char* value = V;}; DEF(int,"%d")DEF(double,"%lf")DEF(float,"%f")DEF(char,"%c")DEF(const char*,"%s")DEF(unsigned long,"%lu")DEF(char*,"%s")DEF(unsigned int, "%u") #ifdef _MSC_VER DEF(long long int,"%I64d") #else DEF(long long int,"%lld") #endif #undef DEF template<typename T> int RD(T& arg){return std::scanf(ScanfSpecifier<T>::value, &arg);} template<int S> int RD(char (&arg)[S]){return std::scanf("%s", arg);} template<> int RD<char*>(char*& arg){return std::scanf("%s", arg);} template<> int RD<char>(char& arg){return std::scanf(" %c", &arg);} template<typename T, typename... Args> int RD(T& arg1, Args&... args) {return RD(arg1) + RD(args...);} template<typename T> T RD(){T ret; RD(ret); return ret;} template<typename It> void RDV(It begin, It end) { while(begin != end) RD(*begin++); } template<typename C> void RDV(C& c) {RDV(std::begin(c), std::end(c));} template<typename... Args> void WT(Args... args) { int alc = 0; int dummy[] = {((alc++? std::printf(" "): 0), std::printf(ScanfSpecifier<Args>::value, args), 0)...}; } template<typename... Args> void WTL(Args... args) { WT(args...); std::printf("\n"); } template<typename It> void WTV(It begin, It end) { int alc = 0; while(begin != end) (alc++? std::printf(" "): 0), WT(*begin++); } template<typename C> void WTV(const C& c) {WTV(std::begin(c), std::end(c));} template<typename It> void WTVL(It begin, It end) { WTV(begin, end); std::printf("\n"); } template<typename C> void WTVL(const C& c) {WTVL(std::begin(c), std::end(c));} using namespace std; namespace XX { template<typename RandIt> class KMPBody { public: struct Iter { int idxP, idxT; int matchIdx; Iter(int p, int t, const KMPBody& b) :idxP(p), idxT(t), body(b) {} int operator*(){return matchIdx;} bool operator!=(const Iter& other){return idxP != other.idxP || idxT != other.idxT;} Iter& operator++() { while(true) { if(idxP == body._plen) { matchIdx = idxT - body._plen; idxP = body._fail[idxP - 1] + 1; break; } else if(idxT == body._tlen) { idxP = idxT = matchIdx = -1; break; } else if(body._pbegin[idxP] == body._tbegin[idxT]) { idxP++; idxT++; } else if(!idxP) idxT++; else idxP = body._fail[idxP - 1] + 1; } return *this; } const KMPBody& body; }; Iter begin()const {return ++Iter(0, 0, *this);} Iter end()const {return Iter(-1, -1, *this);} KMPBody(RandIt pbegin, int plen, RandIt tbegin, int tlen) :_pbegin(pbegin), _plen(plen), _tbegin(tbegin), _tlen(tlen), _fail(plen) { if(!plen) return; _fail[0] = -1; for(int idx = 1; idx < _plen; ++idx) { int last = _fail[idx - 1]; while(last > -1 && _pbegin[last + 1] != _pbegin[idx]) last = _fail[last]; if(_pbegin[last + 1] == _pbegin[idx]) _fail[idx] = last + 1; else _fail[idx] = -1; } } private: std::vector<int> _fail; RandIt _pbegin, _tbegin; int _plen, _tlen; }; //Pattern, Text template<typename RandIt> KMPBody<RandIt> KMP(RandIt pbegin, int plen, RandIt tbegin, int tlen) { return KMPBody<RandIt>(pbegin, plen, tbegin, tlen); } } //alias //KMP using XX::KMP; // (pattern_begin,pattern_len,text_begin,text_len) enumerate occurrence with range-based loop //RD[L],RDV[L],WT[L],WTV[L] for i/o template<typename T> T& UMAX(T& x, T y){return XX::UP<std::greater>(x, y);} template<typename T> T& UMIN(T& x, T y){return XX::UP<std::less>(x, y);} using XX::UP; //(x,y) comp using RG = XX::Range; using XX::MAKEV; using XX::Mapper; //template #include <vector> #include <string> #include <set> #include <map> #include <cstdlib> #include <algorithm> #include <functional> using namespace std; char buf[500009]; char text[1000009]; int main() { RD(buf); strcpy(text, buf); strcat(text, buf); int N = strlen(buf); int len = 0; for(int idx: KMP(buf, N, text, 2 * N)) if(idx && idx < N && N % idx == 0) { len = idx; break; } if(!len) WTL("1\n1"); else if(len == 1) { WTL(N); WTL(1); } else { WTL(2); WTL(N - 1 - (len > 2? N / len - 1: 0)); } }
a.cc: In function 'int main()': a.cc:204:5: error: 'strcpy' was not declared in this scope 204 | strcpy(text, buf); | ^~~~~~ a.cc:194:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 193 | #include <algorithm> +++ |+#include <cstring> 194 | #include <functional> a.cc:205:5: error: 'strcat' was not declared in this scope 205 | strcat(text, buf); | ^~~~~~ a.cc:205:5: note: 'strcat' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:207:13: error: 'strlen' was not declared in this scope 207 | int N = strlen(buf); | ^~~~~~ a.cc:207:13: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s721409131
p04018
C++
#include <algorithm> #include <climits> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(X,Y) ((X)>(Y)?X=(Y),true:false) #define chmax(X,Y) ((X)<(Y)?X=(Y),true:false) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 500010 string s; int n; #define M 1 ll hash[M][N]; ll hmod[M] = {1000000007}; ll base[M] = {101}; ll mypow[M][N]; bool all_equal(){ rep(i, n-1) if(s[i]!=s[i+1]) return false; return true; } void init_hash(){ for(int t = 0; t < M; t++){ hash[t][0] = 0; rep(i, n){ hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; } mypow[t][0] = 1; rep(i, n) mypow[t][i+1] = (mypow[t][i]*base[t])%hmod[t]; } } bool same(int x1, int x2, int k){ for(int t = 0; t < M; t++){ ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*mypow[t][n-x1]%hmod[t]; ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*mypow[t][n-x2]%hmod[t]; if(r1!=r2) return false; } return true; } int main(){ cin>>s; n = s.size(); if(all_equal()){ cout<<n<<endl; cout<<1<<endl; return 0; } init_hash(); for(int i = 2; i <= n/2; i++){ int j = n/i; if(i*j!=n) continue; bool flag = true; for(int k = 1; k < j; k++){ if(!same(0, i*k, i)){ flag = false; break; } } if(flag){ //cerr<<i<<" "<<j<<endl; cout<<2<<endl; ll res = (ll)(i-1)*j; if(j==2) res++; res %= mod; cout<<res<<endl; return 0; } } cout<<1<<endl; cout<<1<<endl; return 0; }
a.cc: In function 'void init_hash()': a.cc:56:17: error: reference to 'hash' is ambiguous 56 | hash[t][0] = 0; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/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:6: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:58:25: error: reference to 'hash' is ambiguous 58 | hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:58:42: error: reference to 'hash' is ambiguous 58 | hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc: In function 'bool same(int, int, int)': a.cc:67:27: error: reference to 'hash' is ambiguous 67 | ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*mypow[t][n-x1]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:67:41: error: reference to 'hash' is ambiguous 67 | ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*mypow[t][n-x1]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:68:27: error: reference to 'hash' is ambiguous 68 | ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*mypow[t][n-x2]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:68:41: error: reference to 'hash' is ambiguous 68 | ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*mypow[t][n-x2]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~
s999205179
p04018
C++
#include <algorithm> #include <climits> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(X,Y) ((X)>(Y)?X=(Y),true:false) #define chmax(X,Y) ((X)<(Y)?X=(Y),true:false) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 500010 string s; int n; #define M 1 ll hash[M][N]; ll hmod[M] = {1000000007}; ll base[M] = {101}; ll mypow[M][N]; bool all_equal(){ rep(i, n-1) if(s[i]!=s[i+1]) return false; return true; } void init_hash(){ for(int t = 0; t < M; t++){ hash[t][0] = 0; rep(i, n){ hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; } mypow[t][0] = 1; rep(i, n) mypow[t][i+1] = (mypow[t][i]*base[t])%hmod[t]; } } bool same(int x1, int x2, int k){ for(int t = 0; t < M; t++){ ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*mypow[t][n-x1]%hmod[t]; ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*mypow[t][n-x2]%hmod[t]; if(r1!=r2) return false; } return true; } int main(){ cin>>s; n = s.size(); if(all_equal()){ cout<<n<<endl; cout<<1<<endl; return 0; } init_hash(); for(int i = 2; i <= n/2; i++){ int j = n/i; if(i*j!=n) continue; bool flag = true; for(int k = 1; k < j; k++){ if(!same(0, i*k, i)){ flag = false; break; } } if(flag){ //cerr<<i<<" "<<j<<endl; cout<<2<<endl; ll res = (ll)(i-1)*j; if(j==2) res++; res %= mod; cout<<res<<endl; return 0; } } cout<<1<<endl; cout<<1<<endl; return 0; }
a.cc: In function 'void init_hash()': a.cc:56:17: error: reference to 'hash' is ambiguous 56 | hash[t][0] = 0; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/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:6: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:58:25: error: reference to 'hash' is ambiguous 58 | hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:58:42: error: reference to 'hash' is ambiguous 58 | hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc: In function 'bool same(int, int, int)': a.cc:67:27: error: reference to 'hash' is ambiguous 67 | ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*mypow[t][n-x1]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:67:41: error: reference to 'hash' is ambiguous 67 | ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*mypow[t][n-x1]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:68:27: error: reference to 'hash' is ambiguous 68 | ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*mypow[t][n-x2]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:68:41: error: reference to 'hash' is ambiguous 68 | ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*mypow[t][n-x2]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~
s588233867
p04018
C++
#include <algorithm> #include <climits> #include <cstdio> #include <cstdlib> #include <ctime> #include <iostream> #include <sstream> #include <functional> #include <map> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <deque> #include <set> #include <list> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> P; const double PI = 3.14159265358979323846; const double EPS = 1e-12; const ll INF = 1LL<<29; const ll mod = 1e9+7; #define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i)) #define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d)) #define all(v) (v).begin(), (v).end() #define pb(x) push_back(x) #define mp(x,y) make_pair((x),(y)) #define mset(m,v) memset((m),(v),sizeof(m)) #define chmin(X,Y) ((X)>(Y)?X=(Y),true:false) #define chmax(X,Y) ((X)<(Y)?X=(Y),true:false) #define fst first #define snd second #define UNIQUE(x) (x).erase(unique(all(x)),(x).end()) template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;} #define N 500010 string s; int n; #define M 1 ll hash[M][N]; ll hmod[M] = {1e9+7}; ll base[M] = {101}; ll pow[M][N]; bool all_equal(){ rep(i, n-1) if(s[i]!=s[i+1]) return false; return true; } void init_hash(){ for(int t = 0; t < M; t++){ hash[t][0] = 0; rep(i, n){ hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; } pow[t][0] = 1; rep(i, n) pow[t][i+1] = (pow[t][i]*base[t])%hmod[t]; } } bool same(int x1, int x2, int k){ for(int t = 0; t < M; t++){ ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*pow[t][n-x1]%hmod[t]; ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*pow[t][n-x2]%hmod[t]; if(r1!=r2) return false; } return true; } int main(){ cin>>s; n = s.size(); if(all_equal()){ cout<<n<<endl; cout<<1<<endl; return 0; } init_hash(); for(int i = 2; i <= n/2; i++){ int j = n/i; if(i*j!=n) continue; bool flag = true; for(int k = 1; k < j; k++){ if(!same(0, i*k, i)){ flag = false; break; } } if(flag){ //cerr<<i<<" "<<j<<endl; cout<<2<<endl; ll res = (ll)(i-1)*j; if(j==2) res++; res %= mod; cout<<res<<endl; return 0; } } cout<<1<<endl; cout<<1<<endl; return 0; }
a.cc:45:18: error: narrowing conversion of '1.000000007e+9' from 'double' to 'll' {aka 'long long int'} [-Wnarrowing] 45 | ll hmod[M] = {1e9+7}; | ~~~^~ a.cc:47:4: warning: built-in function 'pow' declared as non-function [-Wbuiltin-declaration-mismatch] 47 | ll pow[M][N]; | ^~~ a.cc: In function 'void init_hash()': a.cc:56:17: error: reference to 'hash' is ambiguous 56 | hash[t][0] = 0; | ^~~~ In file included from /usr/include/c++/14/string_view:50, from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/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:6: /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:58:25: error: reference to 'hash' is ambiguous 58 | hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:58:42: error: reference to 'hash' is ambiguous 58 | hash[t][i+1] = ((hash[t][i]*base[t])+s[i])%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc: In function 'bool same(int, int, int)': a.cc:67:27: error: reference to 'hash' is ambiguous 67 | ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*pow[t][n-x1]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:67:41: error: reference to 'hash' is ambiguous 67 | ll r1 = ((hash[t][x1+k]-hash[t][x1]+hmod[t])%hmod[t])*pow[t][n-x1]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:68:27: error: reference to 'hash' is ambiguous 68 | ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*pow[t][n-x2]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~ a.cc:68:41: error: reference to 'hash' is ambiguous 68 | ll r2 = ((hash[t][x2+k]-hash[t][x2]+hmod[t])%hmod[t])*pow[t][n-x2]%hmod[t]; | ^~~~ /usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash' 59 | struct hash; | ^~~~ a.cc:44:4: note: 'll hash [1][500010]' 44 | ll hash[M][N]; | ^~~~
s401774514
p04018
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <ctype.h> #include <deque> #include <queue> #include <cstring> #include <set> #include <list> #include <map> #include <random> #include <unordered_map> #include <stdio.h> using namespace std; typedef long long ll; typedef std::vector<int> vi; typedef std::vector<bool> vb; typedef std::vector<string> vs; typedef std::vector<double> vd; typedef std::vector<long long> vll; typedef std::vector<std::vector<int> > vvi; typedef vector<vvi> vvvi; typedef vector<vll> vvll; typedef std::vector<std::pair<int, int> > vpi; typedef vector<vpi> vvpi; typedef std::pair<int, int> pi; typedef std::pair<ll, ll> pll; typedef std::vector<pll> vpll; const long long mod = 1000000007; #define all(c) (c).begin(),(c).end() #define sz(c) (int)(c).size() #define forn(i, a, b) for(int i = a; i < b; i++) #define pb push_back #define mp make_pair char incaa[505000]; vector<int> prefix_function (string s) { int n = (int) s.length(); vector<int> pi (n); for (int i=1; i<n; ++i) { int j = pi[i-1]; while (j > 0 && s[i] != s[j]) j = pi[j-1]; if (s[i] == s[j]) ++j; pi[i] = j; } return pi; } int main() { gets(incaa); string s(incaa); int n = s.size(); bool f1=true; forn(i,0,n) { if(s[i]!=s[0]) f1=false; } if(f1) { cout<<n<<endl; cout<<1<<endl; return 0; } cout<<2<<endl; vi pf1 = prefix_function(s); reverse(all(s)); vi pf2 = prefix_function(s); int cnt =0 ; forn(i,1,n) { int l = i; int r = n-i; int sl = pf1[l-1]; int sr = pf2[r-1]; int dl = l - sl; int dr = r - sr; if((l%dl == 0 && sl>0)|| (r%dr ==0 &&sr>0)) continue; cnt++; } cout<<cnt<<endl; }
a.cc: In function 'int main()': a.cc:60:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 60 | gets(incaa); | ^~~~ | getw
s858796696
p04019
C++
s;n;e;w;i;main(q){char t[1000];for(gets(t);i<strlen(t);i++){q=t[i];if(q==78)n=1;if(q==83)s=1;if(q==69)e=1;if(q==87)w=1;}puts(abs(n-s)+abs(w-e)?"No":"Yes");}
a.cc:1:1: error: 's' does not name a type 1 | s;n;e;w;i;main(q){char t[1000];for(gets(t);i<strlen(t);i++){q=t[i];if(q==78)n=1;if(q==83)s=1;if(q==69)e=1;if(q==87)w=1;}puts(abs(n-s)+abs(w-e)?"No":"Yes");} | ^ a.cc:1:3: error: 'n' does not name a type 1 | s;n;e;w;i;main(q){char t[1000];for(gets(t);i<strlen(t);i++){q=t[i];if(q==78)n=1;if(q==83)s=1;if(q==69)e=1;if(q==87)w=1;}puts(abs(n-s)+abs(w-e)?"No":"Yes");} | ^ a.cc:1:5: error: 'e' does not name a type 1 | s;n;e;w;i;main(q){char t[1000];for(gets(t);i<strlen(t);i++){q=t[i];if(q==78)n=1;if(q==83)s=1;if(q==69)e=1;if(q==87)w=1;}puts(abs(n-s)+abs(w-e)?"No":"Yes");} | ^ a.cc:1:7: error: 'w' does not name a type 1 | s;n;e;w;i;main(q){char t[1000];for(gets(t);i<strlen(t);i++){q=t[i];if(q==78)n=1;if(q==83)s=1;if(q==69)e=1;if(q==87)w=1;}puts(abs(n-s)+abs(w-e)?"No":"Yes");} | ^ a.cc:1:9: error: 'i' does not name a type 1 | s;n;e;w;i;main(q){char t[1000];for(gets(t);i<strlen(t);i++){q=t[i];if(q==78)n=1;if(q==83)s=1;if(q==69)e=1;if(q==87)w=1;}puts(abs(n-s)+abs(w-e)?"No":"Yes");} | ^ a.cc:1:15: error: expected constructor, destructor, or type conversion before '(' token 1 | s;n;e;w;i;main(q){char t[1000];for(gets(t);i<strlen(t);i++){q=t[i];if(q==78)n=1;if(q==83)s=1;if(q==69)e=1;if(q==87)w=1;}puts(abs(n-s)+abs(w-e)?"No":"Yes");} | ^
s106190538
p04019
C
#include<iostream> using namespace std; typedef long long li; #define yn(i) print((i)?"Yes":"No") #define binom2(n) ((n)*(n-1)/2) #define rep(i,n) for(int i=0;i<(n);i++) #define df 0 template<class T> void print(const T& t){ cout << t << "\n"; } template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); } char dir[]={'N','W','S','E'}; int main() { string s; cin >>s; int n=s.size(); int d[]={0,0,0,0}; rep(i,n) rep(j,4) if(s[i]==dir[j]) d[j]|=1; yn(!((d[0]^d[2]) or (d[1]^d[3]))); }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s002333479
p04019
Java
import java.util.*; import java.io.*; import java.math.*; public class Main{ //Don't have to see. start------------------------------------------ static class InputIterator{ ArrayList<String> inputLine = new ArrayList<String>(1024); int index = 0; int max; String read; InputIterator(){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try{ while((read = br.readLine()) != null){ inputLine.add(read); } }catch(IOException e){} max = inputLine.size(); } boolean hasNext(){return (index < max);} String next(){ if(hasNext()){ return inputLine.get(index++); }else{ throw new IndexOutOfBoundsException("There is no more input"); } } } static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>(); static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem. static PrintWriter out = new PrintWriter(System.out); static void flush(){out.flush();} static void myout(Object t){out.println(t);} static void myerr(Object t){System.err.print("debug:");System.err.println(t);} static String next(){return ii.next();} static boolean hasNext(){return ii.hasNext();} static int nextInt(){return Integer.parseInt(next());} static long nextLong(){return Long.parseLong(next());} static double nextDouble(){return Double.parseDouble(next());} static ArrayList<String> nextStrArray(){return myconv(next(), 8);} static ArrayList<String> nextCharArray(){return myconv(next(), 0);} static ArrayList<Integer> nextIntArray(){ ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size()); for(int i = 0; i < input.size(); i++){ ret.add(Integer.parseInt(input.get(i))); } return ret; } static ArrayList<Long> nextLongArray(){ ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size()); for(int i = 0; i < input.size(); i++){ ret.add(Long.parseLong(input.get(i))); } return ret; } static String myconv(Object list, int no){//only join String joinString = CONVSTR.get(no); if(list instanceof String[]){ return String.join(joinString, (String[])list); }else if(list instanceof ArrayList){ return String.join(joinString, (ArrayList)list); }else{ throw new ClassCastException("Don't join"); } } static ArrayList<String> myconv(String str, int no){//only split String splitString = CONVSTR.get(no); return new ArrayList<String>(Arrays.asList(str.split(splitString))); } public static void main(String[] args){ CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, ""); solve();flush(); } //Don't have to see. end------------------------------------------ static void solve(){//Here is the main function String s = next(); String output = "Yes"; if((input.contains("N") && !input.contains("S")) || (!input.contains("N") && input.contains("S")) || (input.contains("E") && !input.contains("W")) || (!input.contains("E") && input.contains("W"))){ output = "No"; } myout(output); } //Method addition frame start //Method addition frame end }
Main.java:74: error: cannot find symbol if((input.contains("N") && !input.contains("S")) || ^ symbol: variable input location: class Main Main.java:74: error: cannot find symbol if((input.contains("N") && !input.contains("S")) || ^ symbol: variable input location: class Main Main.java:75: error: cannot find symbol (!input.contains("N") && input.contains("S")) || ^ symbol: variable input location: class Main Main.java:75: error: cannot find symbol (!input.contains("N") && input.contains("S")) || ^ symbol: variable input location: class Main Main.java:76: error: cannot find symbol (input.contains("E") && !input.contains("W")) || ^ symbol: variable input location: class Main Main.java:76: error: cannot find symbol (input.contains("E") && !input.contains("W")) || ^ symbol: variable input location: class Main Main.java:77: error: cannot find symbol (!input.contains("E") && input.contains("W"))){ ^ symbol: variable input location: class Main Main.java:77: error: cannot find symbol (!input.contains("E") && input.contains("W"))){ ^ symbol: variable input location: class Main Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 8 errors
s195441356
p04019
C++
#include <bits/stdc++.h> #define f(i,j,k) for(int i=j;i<k;i++) using namespace std; int main(){ string s; cin>>s; long long n=0,ss=0,w=0,e=0; f(i,0,s.size()){ if(s[i]=='N'){ n++; } else if(s[i]=='S'){ ss++; } else if(s[i]=='W'){ w++; } else{ e++; } } if(n>0&&ss>0&&w=0&&e=0){ cout<<"Yes"<<endl; } else if(n=0&&ss=0&&w>0&&e>0){ cout<<"Yes"<<endl; } else if(n>0&&ss>0&&w>0&&e>0){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:22: error: lvalue required as left operand of assignment 22 | if(n>0&&ss>0&&w=0&&e=0){ | ~^~~ a.cc:25:16: error: lvalue required as left operand of assignment 25 | else if(n=0&&ss=0&&w>0&&e>0){ | ~^~~~
s373326919
p04019
C++
#include <bits/stdc++.h> using namespace std; #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数 int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数 int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗 int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗 int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和 int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和? int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和 //以下long long ver long long llmax(long long a,long long b){if(a>b){return a;}return b;} long long llmin(long long a,long long b){if(a<b){return a;}return b;} long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);} long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;} long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;} long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;} long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} long long llnHr(long long a,long long b){return llnCr(a+b-1,b);} long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;} long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;} long long llsankaku(long long x){return ((1+x)*x)/2;} //double double dbmax(double a,double b){if(a>b){return a;}return b;} double dbmin(double a,double b){if(a<b){return a;}return b;} double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);} typedef pair<int, int> ii; typedef long long ll; typedef vector<ll> vll; typedef pair<ll,ll> pll; #define forr(i,a,b) ; for(int i=(a); i<(b); i++) #define clean(arr,val) memset(arr,val,sizeof(arr)) #define forn(i,n) forr(i,0,n) #define PB push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<pll> vpll; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; bool is_prime (int x){ if (x<=1) return false ; for (int i=2 ; i*i<=x ; i++){ if (x%i==0) return false ; } return true; } string alpha = "abcdefghijklmnopqrstuvwxyz" ; string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; /*CODE START HERE*/ int main() { string a = "NSWE"; string s; cin >> s; vector <int > data(4,0); forn(i,s.size()){ forn(j,4){ if( s.at(i) == a.at(j){ data.at(j) ++ ; } } } if ( (data.at(0) == 0 && data.at(1) >0) ||(data.at(1) == 0 && data.at(0) >0) ||(data.at(2) == 0 && data.at(3) >0) ||(data.at(3) == 0 && data.at(2) >0) ){ cout << "No" << endl; }else cout << "Yes" << endl; }
a.cc: In function 'int main()': a.cc:74:29: error: expected ')' before '{' token 74 | if( s.at(i) == a.at(j){ | ~ ^ | ) a.cc:77:5: error: expected primary-expression before '}' token 77 | } | ^
s090686083
p04019
C++
#include <bits/stdc++.h> using namespace std; #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数 int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数 int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗 int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗 int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和 int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和? int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和 //以下long long ver long long llmax(long long a,long long b){if(a>b){return a;}return b;} long long llmin(long long a,long long b){if(a<b){return a;}return b;} long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);} long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;} long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;} long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;} long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} long long llnHr(long long a,long long b){return llnCr(a+b-1,b);} long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;} long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;} long long llsankaku(long long x){return ((1+x)*x)/2;} //double double dbmax(double a,double b){if(a>b){return a;}return b;} double dbmin(double a,double b){if(a<b){return a;}return b;} double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);} typedef pair<int, int> ii; typedef long long ll; typedef vector<ll> vll; typedef pair<ll,ll> pll; #define forr(i,a,b) ; for(int i=(a); i<(b); i++) #define clean(arr,val) memset(arr,val,sizeof(arr)) #define forn(i,n) forr(i,0,n) #define PB push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<pll> vpll; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; bool is_prime (int x){ if (x<=1) return false ; for (int i=2 ; i*i<=x ; i++){ if (x%i==0) return false ; } return true; } string alpha = "abcdefghijklmnopqrstuvwxyz" ; string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; /*CODE START HERE*/ int main() { string a = "NSWE"; string s; cin >> s; vector <int > data(4,0); forn(i,s.size()){ forn(j,4){ if( s.at(i) == a.at(j){ data.at(j) ++ ; } } } if ( (data.at(0) == 0 && data.at(1) >0) ||(data.at(1) == 0 && data.at(0) >0) ||(data.at(2) == 0 && data.at(3) >0) ||(data.at(3) == 0 && data.at(2) >0) ){ cout << "No" << endl; }else cout << "Yes" << endl; }
a.cc: In function 'int main()': a.cc:74:29: error: expected ')' before '{' token 74 | if( s.at(i) == a.at(j){ | ~ ^ | ) a.cc:77:5: error: expected primary-expression before '}' token 77 | } | ^
s757149727
p04019
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) typedef long long ll; int main(){ string s; cin >> s; int n=0,w=0,s=0,e=0; rep(i,s.size()){ if(s[i]=='n') n++; else if(s[i]=='w') w++; else if(s[i]=='s') s++; else e++; } string ans; if( (n==0 && s>0) || (n>0 && s==0)){ ans = "No"; } else if( (w==0 && e>0) || (e>0 && w==0) ){ ans = "No"; } else ans = "Yes"; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:17: error: conflicting declaration 'int s' 10 | int n=0,w=0,s=0,e=0; | ^ a.cc:8:12: note: previous declaration as 'std::string s' 8 | string s; | ^ a.cc:14:29: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 14 | else if(s[i]=='s') s++; | ~^~ a.cc:18:19: error: no match for 'operator>' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ~^~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h: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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ 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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ 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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ 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:18:20: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ |
s244455185
p04019
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) typedef long long ll; int main(){ string s; cin >> s; int n=0,w=0,s=0,e=0; rep(i,s.size()){ if(s[i]=='n') n++; else if(s[i]=='w') w++; else if(s[o]=='s') s++; else e++; } string ans; if( (n==0 && s>0) || (n>0 && s==0)){ ans = "No"; } else if( (w==0 && e>0) || (e>0 && w==0) ){ ans = "No"; } else ans = "Yes"; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:17: error: conflicting declaration 'int s' 10 | int n=0,w=0,s=0,e=0; | ^ a.cc:8:12: note: previous declaration as 'std::string s' 8 | string s; | ^ a.cc:14:19: error: 'o' was not declared in this scope 14 | else if(s[o]=='s') s++; | ^ a.cc:14:29: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 14 | else if(s[o]=='s') s++; | ~^~ a.cc:18:19: error: no match for 'operator>' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ~^~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h: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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ 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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ 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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ 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:18:20: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 18 | if( (n==0 && s>0) || (n>0 && s==0)){ | ^ /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:18:20: note: misma
s978053917
p04019
C++
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i,n) for(int i=0;i<(n);++i) #define repi(i,a,b) for(int i=int(a);i<int(b);++i) #define all(x) (x).begin(), (x).end() #define PI 3.14159265358979323846264338327950L using namespace std; typedef long long ll; typedef long double ld; int main() { string q; cin>>q; int n=q.size(); bool n=false,e=false,w=false,s=false; if(n) cout<<1; rep(i,n){ if(q[i]=='n') n=true; else if(q[i]=='e') e=true; else if(q[i]=='w') w=true; else s=true; } if(n&&!s) cout<<"No"; else if(s&&!n) cout<<"No"; else if(e&&!w) cout<<"No"; else if(w&&!e) cout<<"No"; else cout<<"Yes"; }
a.cc: In function 'int main()': a.cc:14:10: error: conflicting declaration 'bool n' 14 | bool n=false,e=false,w=false,s=false; | ^ a.cc:13:9: note: previous declaration as 'int n' 13 | int n=q.size(); | ^
s149364793
p04019
C++
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p); string to_string(const string& s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } string to_string(vector<bool> v) { bool first = true; string res = "{"; for (int i = 0; i < static_cast<int>(v.size()); i++) { if (!first) { res += ", "; } first = false; res += to_string(v[i]); } res += "}"; return res; } template <size_t N> string to_string(bitset<N> v) { string res = ""; for (size_t i = 0; i < N; i++) { res += static_cast<char>('0' + v[i]); } return res; } template <typename A> string to_string(A v) { if(v.size() >= 200) { return "Too big container"; } bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p) { return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")"; } template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p) { return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")"; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #define rep(i,n) for (int i = 0; i < n; ++i) #define per(i,n) for (int i = n - 1; i >= 0; --i) #define rep1(i,n) for (int i = 1; i <= n; ++i) #define reps(i,s,n) for (int i = s; i < n; ++i) #define all(c) begin(c),end(c) template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } typedef long long ll; typedef long double ld; typedef pair<int,int> PINT; typedef pair<ll,ll> PLL; const long long MOD = 1e9+7; #define precout() cout << std::fixed << std::setprecision(20); #define print(a) cout << a << endl; const int INFI = (1 << 30) - 1; const long long INFLL = (1LL << 62) - 1; template<typename T> void printv(vector<T>&v) { int n = v.size() - 1; rep(i, n) cout << v[i] << " "; cout << v.back() << endl; } const int dy[4] = { 0, 1, 0, -1 }; const int dx[4] = { 1, 0, -1, 0 }; const int dy8[8] = { 1, 1, 1, 0, 0, -1, -1, -1 }; const int dx8[8] = { -1, 0, 1, -1, 1, -1, 0, 1 }; double deg2rad(double deg) { return deg * M_PI / 180; } double rad2deg(double rad) { return rad * 180 / M_PI; } int main() { cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; unordered_map<char,bool> cnt; for(auto&c:s) { ++cnt[c]; } bool ok = 1; if( (cnt.count('N') && !cnt.count('S')) || (cnt.count('S') && !cnt.count('N')) || (cnt.count('W') && !cnt.count('E')) || (cnt.count('E') && !cnt.count('W')) ) { ok = 0; } if(ok) { print("Yes"); } else { print("No"); } }
a.cc: In function 'int main()': a.cc:126:16: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17 126 | ++cnt[c]; | ^
s454848884
p04019
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using P = pair<int, int>; typedef long long ll; int main() { string s; cin >> s; bool n, w, s, e; n = false, w = false, s = false, e = false; int n = s.size(); rep(i, n){ if(s[i] == 'N')n=true; if(s[i] == 'W')w=true; if(s[i] == 'S')s=true; if(s[i] == 'E')e=true; } int cn = 0; if(n)cn++; if(w)cn++; if(s)cn++; if(e)cn++; if(cn == 4){ cout << "Yes" << endl; }else if(cn == 3 || cn == 1){ cout << "No" << endl; }else{ if(n){ if(s){ cout << "Yes" << endl; return 0; }else{ cout << "No" << endl; return 0; } } if(w){ if(e){ cout << "Yes" << endl; return 0; }else{ cout << "No" << endl; return 0; } } } }
a.cc: In function 'int main()': a.cc:10:14: error: conflicting declaration 'bool s' 10 | bool n, w, s, e; | ^ a.cc:8:10: note: previous declaration as 'std::string s' 8 | string s; | ^ a.cc:12:7: error: conflicting declaration 'int n' 12 | int n = s.size(); | ^ a.cc:10:8: note: previous declaration as 'bool n' 10 | bool n, w, s, e; | ^ a.cc:22:6: error: could not convert 's' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 22 | if(s)cn++; | ^ | | | std::string {aka std::__cxx11::basic_string<char>} a.cc:30:10: error: could not convert 's' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 30 | if(s){ | ^ | | | std::string {aka std::__cxx11::basic_string<char>}
s126876991
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; k=s.size(); int cnt_x=0; int cnt_y=0; for(int i=0;i<k;i++){ if(s[i]=='W'){cnt_x--;} if(s[i]=='E'){cnt_x++;} if(s[i]=='N'){cnt_y++;} if(s[i]=='S'){cnt_y--;} } if(cnt_x==0 && cnt_y==0)cout << "Yes"<<endl; else cout <<"No"<<endl; }
a.cc: In function 'int main()': a.cc:6:3: error: 'k' was not declared in this scope 6 | k=s.size(); | ^
s107303953
p04019
C++
#include<bits/stdc++.h> using namespace std; /* Chào cô gái, có ph?i em tên t? t? không, mà sao lúc sub bài này anh toàn nghi d?n em th? Miku is waving, start shaking >:( */ typedef long long ll ; const ll mk = 100055; const ll logn = 29; const ll mod = 1e9 + 7; #define endl "\n" #define IOS ios::sync_with_stdio(0); cin.tie(0); #define fi first #define se second #define pii pair<ll,ll> #define pq priority_queue #define UwU uwu #define mp make_pair #define Miku best_waifu #define Miku_dancing god_waving #define Miku_singing god_shaking #define a_Miku cho_doi_bot_ngu vector <ll> Pr; ll d[mk + 5]; unordered_map <ll,ll> occurance; unordered_map <ll,pii> cnt; vector < pii > Rev; void Sieve() // i dont know why my previous sieve goes tle TvT { vector<bool> prime(mk + 5 , 1); for (ll i=3; i * i <=mk; i+=2) { if (prime[i] == true) { for (ll j = i * i ; j <=mk; j += 2*i) prime[j] = false; } } Pr.push_back(2); for (ll p=3; p<=mk; p+=2) if (prime[p]) Pr.push_back(p); } inline pair<ll,ll> root(ll x) // find the root of x { ll val=1,reverse_val=1; for (auto i: Pr) { if(i*i>x) break; if(x%i==0) { ll num=0; while(x%i==0) { num++; x/=i; } num%=3; for(ll j = 0 ; j < num ; j++) val *= i; for(ll j = 0 ; j < 3 - num; j++) reverse_val *= i; } } if(x>1) { // x must be a prime ll num = 1; for(ll i = 0 ; i < num; i++) val *= x; for(ll i = 0 ; i < 3 - num ; i++) reverse_val *= x; } return mp(val,reverse_val); } void solve() { Sieve(); ll n; cin >> n; for (ll i = 1; i <= n; i++) { ll x; cin >> x; if(cnt.count(x)==0) { pair<ll,ll> cur= root(x); Rev.push_back(cur); cnt[x]=cur; } else Rev.push_back(cnt[x]); occurance[Rev.back().first]++; } ll ans=0; if(occurance[1]>=1) ans++; for (ll i = 0; i < n; i++) { ll value = Rev[i].first; ll cur_val = occurance[value]; if(cur_val==0) continue; if(value==1) continue; ll rever = Rev[i].second; ans += max(cur_val, occurance[rever]); occurance[rever]=0; occurance[value]=0; /// cout << " Miku huhuhu" } cout << ans << endl; } ll main() { solve(); }
a.cc:126:1: error: '::main' must return 'int' 126 | ll main() | ^~
s310060194
p04019
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i=0;i<(n);i++) using namespace std; using ll = long long; using P = pair<int,int>; int main() { strng s; cin >> s; bool flag1=true; bool flag2=true; rep(i,s.size()){ if(s.at(i)=='N')flag1=false; if(s.at(i)=='W')flag2=false; } rep(i,s.size()){ if(!flag1){ if(s.at(i)=='S')flag1=true; } if(!flag2){ if(s.at(i)=='E')flag2=true; } } if(flag1&&flag2) cout << "Yes" << endl; else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:9:5: error: 'strng' was not declared in this scope 9 | strng s; | ^~~~~ a.cc:10:12: error: 's' was not declared in this scope 10 | cin >> s; | ^
s386963646
p04019
C++
#include <iostream> using namespace std; string S; int N; int So; int E; int W; int main(){ cin >> S; for(int i = 0; i < sizeof(S); i++){ if(S[i] == "N") N++; if(S[i] == "S") So++; if(S[i] == "E") E++; if(S[i] == "W") W++; } if(N == So && W == E){ cout << "Yes"; } else{ cout << "No"; } }
a.cc: In function 'int main()': a.cc:13:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(S[i] == "N") N++; a.cc:14:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(S[i] == "S") So++; a.cc:15:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 15 | if(S[i] == "E") E++; a.cc:16:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | if(S[i] == "W") W++;
s106372421
p04019
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String S = sc.next(); int cnt_N =0; int cnt_S =0; int cnt_E =0; int cnt_W =0; for(int i=0; i<S.length(); i++){ if(S.charAt(i)=='N')cnt_N++; else if(S.charAt(i)=='S')cnt_S++; else if(S.charAt(i)=='E')cnt_E++; else if(S.charAt(i)=='W')cnt_W++; } if(cnt_N = cnt_S && cnt_E = cnt_W){ System.out.println("Yes"); }else{ System.out.println("No"); } } }
Main.java:18: error: bad operand types for binary operator '&&' if(cnt_N = cnt_S && cnt_E = cnt_W){ ^ first type: int second type: int Main.java:18: error: incompatible types: int cannot be converted to boolean if(cnt_N = cnt_S && cnt_E = cnt_W){ ^ 2 errors
s674759081
p04019
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; int A=0,B=0,C=0,D=0; for(int i=0;i<N;i++){ if(S.at(i)=='N'){ A++; } else if(S.at(i)=='W'){ B++; } else if(S.at(i)=='S'){ C++; } else{ D++; } } if(A==B && B==C){ cout << "Yes" << endl; } else{ cout << "No" << endl; } }
a.cc: In function 'int main()': a.cc:8:17: error: 'N' was not declared in this scope 8 | for(int i=0;i<N;i++){ | ^
s897856520
p04019
C++
#include <iostream> using namespace std; int main(void){ string S; cin >> S; int n = 0,s = 0,w = 0;e = 0; for(int i = 0;i < t.size();i++){ swich(S[i]){ case 'N': n++; break; case 'S': s++; break; case 'W': w++; break; case 'E': e++; break; } } if( ((n > 0 && s > 0) || (n == 0 && s == 0)) && ((w > 0 && e > 0) || (w == 0 && e == 0)) ){ cout << "Yes" << endl; }else{ cout << "No" << endl; } }
a.cc: In function 'int main()': a.cc:6:26: error: 'e' was not declared in this scope 6 | int n = 0,s = 0,w = 0;e = 0; | ^ a.cc:7:22: error: 't' was not declared in this scope 7 | for(int i = 0;i < t.size();i++){ | ^ a.cc:8:8: error: 'swich' was not declared in this scope 8 | swich(S[i]){ | ^~~~~
s407836160
p04019
C++
#include<bits/stdc++.h> using namespace std; int main(){ string S;cin>>S; int n[]={0,0,0,0}; map<char,int> mp={['N',0],['S',1],['E',2],['W',3]}; for(auto c:S) n[mp[c]]=1; if(n[0]^n[1] || n[2]^n[3]) cout<<"No"<<endl; else cout<<"Yes"<<endl; }
a.cc: In function 'int main()': a.cc:6:22: error: expected identifier before 'N' 6 | map<char,int> mp={['N',0],['S',1],['E',2],['W',3]}; | ^~~ a.cc:6:25: error: expected ']' before ',' token 6 | map<char,int> mp={['N',0],['S',1],['E',2],['W',3]}; | ^ | ] a.cc: In lambda function: a.cc:6:25: error: expected '{' before ',' token a.cc: In function 'int main()': a.cc:6:27: error: expected '}' before ']' token 6 | map<char,int> mp={['N',0],['S',1],['E',2],['W',3]}; | ~ ^ a.cc:6:27: error: could not convert '{<lambda closure object>main()::<lambda()>(), 0}' from '<brace-enclosed initializer list>' to 'std::map<char, int>' 6 | map<char,int> mp={['N',0],['S',1],['E',2],['W',3]}; | ^ | | | <brace-enclosed initializer list> a.cc:6:27: error: expected ',' or ';' before ']' token a.cc: At global scope: a.cc:7:3: error: expected unqualified-id before 'for' 7 | for(auto c:S) n[mp[c]]=1; | ^~~ a.cc:8:3: error: expected unqualified-id before 'if' 8 | if(n[0]^n[1] || n[2]^n[3]) cout<<"No"<<endl; | ^~ a.cc:9:3: error: expected unqualified-id before 'else' 9 | else cout<<"Yes"<<endl; | ^~~~ a.cc:10:1: error: expected declaration before '}' token 10 | } | ^
s653376948
p04019
C++
#include <bits/stdc++.h> #define rep(X,N) for(ll X = 0LL; X < (N); X++) #define PI (acos(-1.0)) #define MODN 1000000007 #define MODN2 998244353 #define ALL(V) (V).begin(),(V).end() #define INT_MAX_HALF (INT_MAX / 2) #define EPS (1e-10) using namespace std; typedef long long ll; int main(){ string s; cin >> s; int n = 0; int w = 0; int s = 0; int e = 0; int size = s.size(); rep(i, size){ if(s[i] == 'N'){ n++; }else if(s[i] == 'W'){ w++; }else if(s[i] == 'S'){ s++; }else{ e++; } } bool ans = true; if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; if((e == 0 && w > 0) || (w == 0 && e > 0)) ans = ans && false; cout << (ans ? "Yes" : "No") << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: conflicting declaration 'int s' 21 | int s = 0; | ^ a.cc:16:12: note: previous declaration as 'std::string s' 16 | string s; | ^ a.cc:32:14: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 32 | s++; | ~^~ a.cc:40:21: error: no match for 'operator>' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ~ ^ ~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h: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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ 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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ 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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ 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:40:23: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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:40:23: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 40 | if((n == 0 && s > 0) || (s == 0 && n > 0)) ans = false; | ^ /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_vie
s283670352
p04019
C++
#include<bits/stdc++.h> using namespace std; int main() { string S; cin >> S; map<char,bool>Map; for (char c : a) { Map[c] = true; } if ((Map['N'] == Map['S']) && (Map['E'] == Map['W'])) { cout << "Yes" << endl; } else { cout << "No" << endl; } }
a.cc: In function 'int main()': a.cc:7:23: error: 'a' was not declared in this scope 7 | for (char c : a) { | ^
s552010582
p04019
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout<<setprecision(32); string s; cin>>s; map<char, int> mp; for(auto ch : s){ mp[ch]++; } if(mp['N'] > 0 && mp['S'] == 0)cout<<"No"<<'\n'; else if(mp['S'] > 0 && mp['N'] == 0)cout<<"No"<<'\n'; else if(mp['E'] > 0 && mp['W'] == 0)cout<<"No"<<'\n'; else if(mp['W'] > 0 && mp['E'] == 0)cout<<"No"<<'\n'; else cout<<"Yes"<<'\n' return 0; }
a.cc: In function 'int main()': a.cc:24:31: error: expected ';' before 'return' 24 | else cout<<"Yes"<<'\n' | ^ | ; 25 | 26 | return 0; | ~~~~~~
s753400588
p04019
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; typedef pair<int, int> P; ll Mod = 1000000007; int main() { string S; cin >> S; bool N = false; bool W = false; bool S = false; bool E = false; for (int i = 0; i < S.size(); i++) { if (S[i] == 'N') { N = true; } if (S[i] == 'W') { W = true; } if (S[i] == 'S') { S = true; } if (S[i] == 'E') { E = true; } } bool ans = true; if ((!N && S) || (N && !S)) { ans = false; } if ((!W && E) || (W && !E)) { ans = false; } if (ans) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:8: error: conflicting declaration 'bool S' 11 | bool S = false; | ^ a.cc:7:10: note: previous declaration as 'std::string S' 7 | string S; | ^ a.cc:28:11: error: no match for 'operator&&' (operand types are 'bool' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 28 | if ((!N && S) || (N && !S)) { | ~~ ^~ ~ | | | | bool std::string {aka std::__cxx11::basic_string<char>} a.cc:28:11: note: candidate: 'operator&&(bool, bool)' (built-in) 28 | if ((!N && S) || (N && !S)) { | ~~~^~~~ a.cc:28:11: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:28:14: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 28 | if ((!N && S) || (N && !S)) { | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:28:14: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 28 | if ((!N && S) || (N && !S)) { | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:28:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 28 | if ((!N && S) || (N && !S)) { | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:28:14: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 28 | if ((!N && S) || (N && !S)) { | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:28:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 28 | if ((!N && S) || (N && !S)) { | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const valarray<_Tp>&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:28:14: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 28 | if ((!N && S) || (N && !S)) { | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:28:14: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 28 | if ((!N && S) || (N && !S)) { | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:28:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 28 | if ((!N && S) || (N && !S)) { | ^ a.cc:28:26: error: no match for 'operator!' (operand type is 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 28 | if ((!N && S) || (N && !S)) { | ^~ a.cc:28:26: note: candidate: 'operator!(bool)' (built-in) a.cc:28:26: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
s904009382
p04019
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int ,int > pii; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const ll maxn = 3e6; const ll mod =1e9+7; const ld PI = acos((ld)-1); #define pb push_back #define endl '\n' #define dokme(x) return(cout << x , 0); #define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ms(x , y) memset(x , y , sizeof x); #define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout); ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);} int x; string t; int main(){ migmig cin >> x >> t; int n = 0 , s = 0 , e = 0 , w = 0; for(int i = 0 ; i < t ; i ++){ if(s[i] == 'N')n++; if(s[i] == 'S')s++; if(s[i] == 'E')e++; if(s[i] == 'W')w++; } if(n){ if(!s)dokme("NO"); } if(s){ if(!n)dokme("NO"); } if(e){ if(!w)dokme("NO"); } if(w){ if(!e)dokme("NO"); } cout << "YES"; return(0); }
a.cc: In function 'int main()': a.cc:30:23: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 30 | for(int i = 0 ; i < t ; i ++){ | ~ ^ ~ | | | | int std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed: a.cc:30:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ 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:30:25: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ 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:30:25: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ 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:30:25: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /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:30:25: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:30:25: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 30 | for(int i = 0 ; i < t ; i ++){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<cl
s450574730
p04019
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); char[] ch=sc.next().toCharArray(); int[] nums=new int[4]; for(int i=0;i<ch.length;i++){ switch(ch[i]){ case 'N': nums[0]++; break; case 'W': nums[1]++; break; case 'S': nums[2]++; break; case 'E': nums[3]++; break; } } if(((nums[0]>0&&nums[2]>0)||(nums[0]==0&&nums[2]==0))&&((nums[1]>0&&nums[3]>0)||(nums[1]==0&&nums[3]==0)){ System.out.println("Yes"); }else{ System.out.println("No"); } } }
Main.java:23: error: ')' expected if(((nums[0]>0&&nums[2]>0)||(nums[0]==0&&nums[2]==0))&&((nums[1]>0&&nums[3]>0)||(nums[1]==0&&nums[3]==0)){ ^ 1 error
s021304953
p04019
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); char[] ch=sc.next().toCharArray(); int[] nums=new int[4]; for(int i=0;i<ch.length;i++){ switch(ch[i]){ case 'N': nums[0]++; break; case 'W': nums[1]++; break; case 'S': nums[2]++; break; case 'E': nums[3]++; break; } } if(nums[0]>0&&nums[1]>0&&nums[2]>0&&nums[3]>0){ System.out,println("Yes"); }else{ System.out.println("No"); } } }
Main.java:24: error: not a statement System.out,println("Yes"); ^ Main.java:24: error: ';' expected System.out,println("Yes"); ^ 2 errors
s469019330
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin>>S; vector<bool>vec(4); int s=S.size(); for(int i=0; i<s; i++){ if(S.at(i)=="N"){ vec.at(0)=true; } else if(S.at(i)=="W"){ vec.at(1)=true; } else if(S.at(i)=="S"){ vec.at(2)=true; } else if(S.at(i)=="E"){ vec.at(3)=true; } } if(vec.at(0)==true&&vec.at(1)==true&&vec.at(2)==true&&vec.at(3)==true){ cout<<"Yes"<<endl; } else if(vec.at(0)==true&&vec.at(1)==false&&vec.at(2)==true&&vec.at(3)==false) cout<<"Yes"<<endl; else if(vec.at(0)==false&&vec.at(1)==true&&vec.at(2)==false&&vec.at(3)==true) cout<<"Yes"<<endl; else cout<<"No"<<endl;}
a.cc: In function 'int main()': a.cc:9:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if(S.at(i)=="N"){ | ~~~~~~~^~~~~ a.cc:12:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 12 | else if(S.at(i)=="W"){ | ~~~~~~~^~~~~ a.cc:15:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 15 | else if(S.at(i)=="S"){ | ~~~~~~~^~~~~ a.cc:18:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 18 | else if(S.at(i)=="E"){ | ~~~~~~~^~~~~
s096111558
p04019
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; int N , W , S , E; int main() { string S; cin >> S; int T = S.size(); for(int i = 0; i < T; i++){ if(S.at(i) == 'N'){ N++; } if(S.at(i) == 'W'){ W++; } if(S.at(i) == 'S'){ S++; } if(S.at(i) == 'E'){ E++; } } if(N > 0 && S > 0 && W > 0 && E > 0){ cout << "Yes" << endl; return 0; } else if(N = 0 && S = 0 && W > 0 && E > 0){ cout << "Yes" << endl; return 0; } else if(N > 0 && S > 0 && W = 0 && E = 0){ cout << "Yes" << endl; return 0; } cout << "No" << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:14: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 18 | S++; | ~^~ a.cc:24:19: error: no match for 'operator>' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ~ ^ ~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h: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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ 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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ 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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ 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:24:21: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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:24:21: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 24 | if(N > 0 && S > 0 && W > 0 && E > 0){ | ^ /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, _All
s847384291
p04019
C++
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <queue> #include <stack> #include <set> #include <map> #include <iomanip> #include <utility> #include <tuple> #include <functional> #include <bitset> #include <cassert> #include <complex> #include <time.h> #define ll long long #define double long double #define itn int #define endl '\n' #define co(ans) cout<<ans<<endl; #define COYE cout<<"YES"<<endl; #define COYe cout<<"Yes"<<endl; #define COye cout<<"yes"<<endl; #define CONO cout<<"NO"<<endl; #define CONo cout<<"No"<<endl; #define COno cout<<"no"<<endl; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define ALL(V) ((V).begin(),(V).end()) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define EPS 1e-10 #define PI 3.141592653589793238 #define MOD 1000000007 #define MAX 5100000 template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} const int vx[4]={0,1,0,-1},vy[4]={1,0,-1,0}; using namespace std; int main(){ string T; cin>>T; int N=0,W=0,S=0,E=0; REP(i,T.size()){ if(S.at(i)=='N') N++; if(S.at(i)=='W') W++; if(S.at(i)=='S') S++; if(S.at(i)=='E') E++; } if(N==S&&W==E) cout<<"Yes"<<endl; else cout<<"No"<<endl; }
a.cc: In function 'int main()': a.cc:52:10: error: request for member 'at' in 'S', which is of non-class type 'int' 52 | if(S.at(i)=='N') N++; | ^~ a.cc:53:10: error: request for member 'at' in 'S', which is of non-class type 'int' 53 | if(S.at(i)=='W') W++; | ^~ a.cc:54:10: error: request for member 'at' in 'S', which is of non-class type 'int' 54 | if(S.at(i)=='S') S++; | ^~ a.cc:55:10: error: request for member 'at' in 'S', which is of non-class type 'int' 55 | if(S.at(i)=='E') E++; | ^~
s024111098
p04019
C++
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <queue> #include <stack> #include <set> #include <map> #include <iomanip> #include <utility> #include <tuple> #include <functional> #include <bitset> #include <cassert> #include <complex> #include <time.h> #define ll long long #define double long double #define itn int #define endl '\n' #define co(ans) cout<<ans<<endl; #define COYE cout<<"YES"<<endl; #define COYe cout<<"Yes"<<endl; #define COye cout<<"yes"<<endl; #define CONO cout<<"NO"<<endl; #define CONo cout<<"No"<<endl; #define COno cout<<"no"<<endl; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FFOR(i,a,b) for(int i=(a);i<=(b);++i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) FFOR(i,1,n) #define ALL(V) ((V).begin(),(V).end()) #define SORT(V) sort((V).begin(),(V).end()) #define REVERSE(V) reverse((V).begin(),(V).end()) #define INF ((1LL<<62)-(1LL<<31)) #define EPS 1e-10 #define PI 3.141592653589793238 #define MOD 1000000007 #define MAX 5100000 template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} const int vx[4]={0,1,0,-1},vy[4]={1,0,-1,0}; using namespace std; int main(){ string S; cin>>S; int N=0,W=0,S=0,E=0; REP(i,S.size()){ if(S.at(i)=='N') N++; if(S.at(i)=='W') W++; if(S.at(i)=='S') S++; if(S.at(i)=='E') E++; } if(N==S&&W==E) cout<<"Yes"<<endl; else cout<<"No"<<endl; }
a.cc: In function 'int main()': a.cc:49:15: error: conflicting declaration 'int S' 49 | int N=0,W=0,S=0,E=0; | ^ a.cc:47:10: note: previous declaration as 'std::string S' 47 | string S; | ^ a.cc:54:23: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 54 | if(S.at(i)=='S') S++; | ~^~ a.cc:58:7: error: no match for 'operator==' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ~^~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | int In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::fpos<_StateT>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::allocator<_CharT>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<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:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:58:9: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const _CharT*' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<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:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:58:9: note: mismatched types 'const std::istreambuf_iterator<_CharT, _Traits>' and 'int' 58 | if(N==S&&W==E) cout<<"Yes"<<endl; | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:2050:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2050 | operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/i
s445914047
p04019
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int a=s.size(); int n=0; int s=0; int w=0; int e=0; for(int i=0;i<a;i++){ if(s.at(i)=='N'){ n++; }else if(s.at(i)=='S'){ s++; }else if(s.at(i)=='E'){ e++; }else if(s.at(i)=='W'){ w++; } } if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ cout << "No" <<endl; }else{ cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:10:13: error: conflicting declaration 'int s' 10 | int s=0; | ^ a.cc:6:16: note: previous declaration as 'std::string s' 6 | string s; | ^ a.cc:17:26: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 17 | s++; | ~^~ a.cc:24:20: error: no match for 'operator!=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ~^~~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/regex.h:1212: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>&)' 1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed: a.cc:24:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/regex.h:1305: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>&)' 1305 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed: a.cc:24:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1473 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed: a.cc:24:22: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1647 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ 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:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:24:22: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 24 | if((n==0&&s!=0)||(n!=0&&s==0)||(e==0&&w!=0)||(e!=0&&w==0)){ | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:243:5: note: ca
s723847429
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin>>s; bool n,w,s,e; n=false; w=false; s=false; e=false; for(int i=0;i<s.size();i++){ if(s[i]=='N') n=true; else if(s[i]=='W') w=true; else if(s[i]=='S') s=true; else e=true; } if((s && n) && (w && e)) cout<<"Yes"<<endl; else if((s && n) && (!w && !e)) cout<<"Yes"<<endl; else if((!s && !n) && (!w && !e)) cout<<"Yes"<<endl; else if((!s && !n) && (w && e)) cout<<"Yes"<<endl; else cout<<"No"<<endl; }
a.cc: In function 'int main()': a.cc:7:12: error: conflicting declaration 'bool s' 7 | bool n,w,s,e; | ^ a.cc:5:10: note: previous declaration as 'std::string s' 5 | string s; | ^ a.cc:18:9: error: no match for 'operator&&' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'bool') 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ~ ^~ ~ | | | | | bool | std::string {aka std::__cxx11::basic_string<char>} a.cc:18:9: note: candidate: 'operator&&(bool, bool)' (built-in) 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ~~^~~~ a.cc:18:9: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:18:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:18:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:18:12: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:18:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:18:12: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const valarray<_Tp>&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:18:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:18:12: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:18:12: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 18 | if((s && n) && (w && e)) cout<<"Yes"<<endl; | ^ a.cc:19:14: error: no match for 'operator&&' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'bool') 19 | else if((s && n) && (!w && !e)) cout<<"Yes"<<endl; | ~ ^~ ~ | | | | | bool | std::string {aka std::__cxx11::basic_string<char>} a.cc:19:14: note: candidate: 'operator&&(bool, bool)' (built-in) 19 | else if((s && n) && (!w && !e)) cout<<"Yes"<<endl; | ~~^~~~ a.cc:19:14: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:19:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 19 | else if((s && n) && (!w && !e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:19:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 19 | else if((s && n) && (!w && !e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:19:17: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 19 | else if((s && n) && (!w && !e)) cout<<"Yes"<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std:
s533481060
p04019
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } return vec; } void output(vector<int> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } return; } vector<vector<int>> input(int n, int m) { vector<vector<int>> table(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> table. at(i).at(j); } } return table; } void output(vector<vector<int>> table) { for (int i = 0; i < table.size(); i++) { for (int j = 0; j < table.at(0).size(); j++) { cout << table.at(i).at(j) << " "; } cout << endl; } } long long perm(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long perm = 1; for (int i = n; i > n - r; i--) { perm *= i; } return perm; } long long comb(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long comb = perm(n,r); for (int i = r; i > 0; i--) { comb /= i; } return comb; } long long homo(int n, int r) { return comb(n + r - 1, n - 1); } long long fact(int n) { long long fact = 1; for (int i = n; i > 0; i--) { fact *= i; } return fact; } int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } } int lcm(int a, int b) { return a * b / gcd(a, b); } int main() { string x; cin >> x; int e=0,n=0,s=0,w=0; for(int i=0;i<n;i++){ if(x[i]=="E"){ e++; } if(x[i]=="N"){ n++; } if(x[i]=="S"){ s++; } if(x[i]=="W"){ w++; } } if(e-w==e||w-e==w){ cout << "No" << endl; } else if(n-s==n||s-n==s){ cout << "No" << endl; }else{ cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:89:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 89 | if(x[i]=="E"){ a.cc:92:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 92 | if(x[i]=="N"){ a.cc:95:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 95 | if(x[i]=="S"){ a.cc:98:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 98 | if(x[i]=="W"){
s770417866
p04019
C++
#include<bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; int N=0, S=0, E=0, W=0; for(int i=0; i<S.size(); i++){ if(S.at(i)=='N'){ N=1; } if(S.at(i)=='S'){ S=1; } if(S.at(i)=='E'){ E=1; } if(S.at(i)=='W'){ W=1; } } if(N!=S || E!=W){ cout << "No" << endl; } else{ cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:7:12: error: conflicting declaration 'int S' 7 | int N=0, S=0, E=0, W=0; | ^ a.cc:5:10: note: previous declaration as 'std::string S' 5 | string S; | ^ a.cc:22:7: error: no match for 'operator!=' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 22 | if(N!=S || E!=W){ | ~^~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | 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:1132:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1132 | operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1132:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/regex.h:1212: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>&)' 1212 | operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1212:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/regex.h:1305: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>&)' 1305 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1305:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/regex.h:1379:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1379 | operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1379:5: note: template argument deduction/substitution failed: a.cc:22:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/regex.h:1473:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1473 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1473:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/regex.h:1547:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1547 | operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1547:5: note: template argument deduction/substitution failed: a.cc:22:9: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/regex.h:1647:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator!=(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1647 | operator!=(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1647:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/regex.h:2213:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator!=(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2213 | operator!=(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2213:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and 'int' 22 | if(N!=S || E!=W){ | ^ 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:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 22 | if(N!=S || E!=W){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 22 | if(N!=S || E!=W){ | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::fpos<_StateT>' and 'int' 22 | if(N!=S || E!=W){ | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'const std::allocator<_CharT>' and 'int' 22 | if(N!=S || E!=W){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 22 | if(N!=S || E!=W){ | ^ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:22:9: note: mismatched types 'std::basic_string_view<_CharT, _Traits>
s308096800
p04019
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0;i < (n);i++) using namespace std; using ll = long long; using pii = pair<int,int>; int main(){ string a; cin >> a; int n = 0,w = 0;s = 0;e = 0; rep(i,a.size()){ if(a[i] == 'N')n++; else if(a[i] == 'W')w++; else if(a[i] == 'S')s++; else if(a[i] == 'E')e++; } if(s == n && w == e) cout << "Yes" << endl; else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:10:21: error: 's' was not declared in this scope 10 | int n = 0,w = 0;s = 0;e = 0; | ^ a.cc:10:27: error: 'e' was not declared in this scope 10 | int n = 0,w = 0;s = 0;e = 0; | ^
s012463077
p04019
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i=(a);i<(b);++i) #define rep(i, n) FOR(i, 0, n) #define whole(x) (x).begin(),(x).end() #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) using ll = long long; using P = pair<int, int>; const int mod = 1000000007; int main() { string s; cin >> s; map<char, int> mp; rep(i, s.size()) { mp[s[i]]++; } string ans = "Yes"; if (mp['N']==0 ^^ mp['S']==0) ans = "No"; if (mp['E']==0 ^^ mp['W']==0) ans = "No"; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:19: error: expected primary-expression before '^' token 20 | if (mp['N']==0 ^^ mp['S']==0) ans = "No"; | ^ a.cc:21:19: error: expected primary-expression before '^' token 21 | if (mp['E']==0 ^^ mp['W']==0) ans = "No"; | ^
s138264354
p04019
C++
#include <bits/stdc++.h> using namespace std; using ll=long long; const ll MOD=1000000007; const double PI=3.14159265358979; const ll INF= pow(10,18); typedef pair<ll,ll> P; typedef vector<llll> vl; typedef vector<vl> vvl; #define FOR(i,a,b) for(ll i=a;i<b;i++) #define rep(i,n) FOR(i,0,n) string abc="abcdefghijklmnopqrstuvwxyz"; string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main() { string s; cin >> s; ll k=s.size(); ll a=0,b=0,c=0,d=0; rep(i,k){ if(s[i]=='S'){ a++; } else if(s[i]=='N'){ b++; } else if(s[i]=='W'){ c++; } else d++; } if(a*b==0&&max(a,b)!=0){ cout << "No" << endl; } else if(c*d==0&&max(c,d)!=0){ cout << "No" << endl; } else cout << "Yes" << endl; }
a.cc:8:16: error: 'llll' was not declared in this scope 8 | typedef vector<llll> vl; | ^~~~ a.cc:8:20: error: template argument 1 is invalid 8 | typedef vector<llll> vl; | ^ a.cc:8:20: error: template argument 2 is invalid
s557562838
p04019
C++
/* Author : N_o_o_B Created : April 22 2020 22:57:50 */ #include <bits/stdc++.h> using namespace std; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; */ #define TRACE #ifdef TRACE #define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);} #undef endl template <typename Arg1,typename Arg2> ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) { return out<<"("<<x.first<<","<<x.second<<")"; } template <typename Arg1> ostream& operator << (ostream& out, const vector<Arg1> &a) { out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]"; } template <typename Arg1> ostream& operator << (ostream& out, const set<Arg1> &a) { out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]"; } template <typename Arg1,typename Arg2> ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) { out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]"; } template <typename Arg1> void __trace__(const string name, Arg1&& arg1){ cerr << name << " : " << arg1 << " ] " << endl; } template <typename Arg1, typename... Args> void __trace__(const string names, Arg1&& arg1, Args&&... args){ const string name = names.substr(0,names.find(',')); cerr<<name<<" : "<<arg1<<" | "; __trace__(names.substr(1+(int)name.size()), args...); } #else #define trace(args...) #endif typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pair<int,int>> vii; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<pair<ll,ll>> vll; typedef vector<vl> vvl; //typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset; #define fori(i,n) for(int i=0;i<n;i++) #define rep(i,a,b) for(int i=a;i<=b;i++) #define repd(i,a,b) for(int i=a;i>=b;i--) #define ford(i,n) for(int i=n-1;i>=0;i--) #define trav(x,a) for(auto& x:a) #define all(x) x.begin(),x.end() #define pb push_back #define endl '\n' #define sz(a) (int)a.size() #define fi first #define se second clock_t time_p=clock(); void time_taken() { time_p=clock()-time_p; cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n"; } //const ll mod=998244353; const ll mod=1e9+7; const ll INF=1e18; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); cout.precision(12);cout << fixed; string s; cin >> s; bool ok = 1; vi cnt(4);int i=0; for(char c:{'N','S','E','W'}){ cnt[i] = 0; for(char c1:s){ cnt[i] += (c1 == c); } cnt[i] = bool(cnt[i]); i++; } bool ok = !(cnt[0]^cnt[1]); ok &= (!(cnt[2]^cnt[3])); cout << (ok ? "Yes":"No") << endl; time_taken(); return 0; }
a.cc: In function 'int main()': a.cc:99:10: error: redeclaration of 'bool ok' 99 | bool ok = !(cnt[0]^cnt[1]); | ^~ a.cc:89:10: note: 'bool ok' previously declared here 89 | bool ok = 1; | ^~
s028141260
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<string> t = {"NS", "WE", "NEWS"}; for (int i = 0; i < 3; i++) { sort(all(t[i])); } string s; cin >> s; sort(all(s)); s.erase(unique(s.begin(), s.end()), s.end()); if (find(all(t), s) == t.end()) { cout << "No" << endl; } else { cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:8:14: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'? 8 | sort(all(t[i])); | ^~~ | std::filesystem::perms::all In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200, from a.cc:1: /usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here 158 | all = 0777, | ^~~ a.cc:12:10: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'? 12 | sort(all(s)); | ^~~ | std::filesystem::perms::all /usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here 158 | all = 0777, | ^~~
s253907597
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; bool S= false; bool W= false; bool N= false; bool E= false; int l = s.size(); for(int i = 0;i < l;i++){ switch (s[i]) { case 'S' : S = true; break; case 'W' : W = true; break; case 'N' : N = true; break; default : E = true; break; } } if((N&&S)||(W&&E)||(N&&S&&W&&E)){ cout << "Yes" <<endl; } else{ cout << "No" <<endl; }
a.cc: In function 'int main()': a.cc:37:2: error: expected '}' at end of input 37 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s516302327
p04019
C++
#include <string> #include <iostream> using namespace std; int main(){ string s; cin >> s; int x=0,y=0; for(int i=0;i<s.length();i++){ if(s[i]=='N') y++; if(s[i]=='S') y--; if(s[i]=='W') s--; if(s[i]=='E') s++; } string ans; if(x==0 and y==0) ans="Yes"; else ans="No"; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:19: error: no 'operator--(int)' declared for postfix '--' [-fpermissive] 10 | if(s[i]=='W') s--; | ~^~ a.cc:11:19: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 11 | if(s[i]=='E') s++; | ~^~
s448117932
p04019
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main(void){ char s[1005]; scanf("%s",s); int n=0,w=0,e=0,s=0; for(int i=0;s[i]!='\0';i++){ if(s[i]=='s'){s++;} if(s[i]=='n'){n++;} if(s[i]=='w'){w++;} if(s[i]=='e'){e++;} } if(s==0&&n!=0||s!=0&&n==0){printf("No");} else if(w==0&&e!=0||w!=0&&e==0){printf("No");} else{printf("Yes");} }
main.c: In function 'main': main.c:8:17: error: conflicting types for 's'; have 'int' 8 | int n=0,w=0,e=0,s=0; | ^ main.c:6:6: note: previous declaration of 's' with type 'char[1005]' 6 | char s[1005]; | ^
s387601287
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int a,b,c,d; a = 0; b = 0; c = 0; d = 0; vector<char> a(S.size()); for (int i = 0; i < S.size(); i++) { if (S.at(i) == 'N') { a++; } else if (S.at(i) == 'W') { b++; } else if (S.at(i) == 'S') { c++; } else { d++; } } if (a > 0 && c == 0) { cout << "No" <<endl; } else if (b > 0 && d == 0) { cout << "No" <<endl; } else if (a == 0 && c > 0) { cout << "No" <<endl; } else if (b == 0 && d > 0) { cout << "No" <<endl; } else { cout << "Yes" <<endl; } }
a.cc: In function 'int main()': a.cc:12:16: error: conflicting declaration 'std::vector<char> a' 12 | vector<char> a(S.size()); | ^ a.cc:7:7: note: previous declaration as 'int a' 7 | int a,b,c,d; | ^
s359695976
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin S; int a,b,c,d; a = 0; b = 0; c = 0; d = 0; vector<char> a(S.size()); for (int i = 0; i < S.size(); i++) { if (S.at(i) == 'N') { a++; } else if (S.at(i) == 'W') { b++; } else if (S.at(i) == 'S') { c++; } else { d++; } } if (a > 0 && c == 0) { cout << "No" <<endl; } else if (b > 0 && d == 0) { cout << "No" <<endl; } else if (a == 0 && c > 0) { cout << "No" <<endl; } else if (b == 0 && d > 0) { cout << "No" <<endl; } else { cout << "Yes" <<endl; } }
a.cc: In function 'int main()': a.cc:6:6: error: expected ';' before 'S' 6 | cin S; | ^ ~ | ; a.cc:12:16: error: conflicting declaration 'std::vector<char> a' 12 | vector<char> a(S.size()); | ^ a.cc:7:7: note: previous declaration as 'int a' 7 | int a,b,c,d; | ^
s192036510
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int a,b,c,d; int a = b - c = d =0; for (int i = 0; i < S.size(); i++) { if (S.at(i) == 'N') { a++; } else if (S.at(i) == 'W') { b++; } else if (S.at(i) == 'S') { c++; } else { d++; } } if (a == d && b == c) { cout << "Yes" <<endl; } else { cout << "No" <<endl; } }
a.cc: In function 'int main()': a.cc:8:7: error: redeclaration of 'int a' 8 | int a = b - c = d =0; | ^ a.cc:7:7: note: 'int a' previously declared here 7 | int a,b,c,d; | ^ a.cc:8:13: error: lvalue required as left operand of assignment 8 | int a = b - c = d =0; | ~~^~~
s955258522
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int a = b = c = d = 0; for (int i = 0; i < S.size(); i++) { if (S.at(i) == 'N') { a++; } else if (S.at(i) == 'W') { b++; } else if (S.at(i) == 'S') { c++; } else { d++; } } if (a == d && b == c) { cout << "Yes" <<endl; } else { cout << "No" <<endl; } }
a.cc: In function 'int main()': a.cc:7:11: error: 'b' was not declared in this scope 7 | int a = b = c = d = 0; | ^ a.cc:7:15: error: 'c' was not declared in this scope 7 | int a = b = c = d = 0; | ^ a.cc:7:19: error: 'd' was not declared in this scope 7 | int a = b = c = d = 0; | ^
s344636961
p04019
C++
#include<bits/stdc++.h> using namespace std; int main() { string T; cin >> T; int n, s, e, w = 0; for (int i = 0; i < S.size(); i++) { if (T.at(i) == 'N') { n++; } if (T.at(i) == 'S') { s++; } if (T.at(i) == 'E') { e++; } if (T.at(i) == 'W') { w++; } } if (n > 0 && s == 0) { cout << "No" << endl; } else if (s > 0 && n == 0) { cout << "No" << endl; } else if (e > 0 && w == 0) { cout << "No" << endl; } else if (w > 0 && e == 0) { cout << "No" << endl; } else { cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:9:23: error: 'S' was not declared in this scope 9 | for (int i = 0; i < S.size(); i++) { | ^
s329136047
p04019
C++
#include<bits/stdc++.h> using namespace std; int main() { string T; cin >> T; int n, s, e, w = 0; for (int i = 0; i < S.size(); i++) { if (T.at(i) == "N") { n++; } if (T.at(i) == "S") { s++; } if (T.at(i) == "E") { e++; } if (T.at(i) == "W") { w++; } } if (n > 0 && s == 0) { cout << "No" << endl; } else if (s > 0 && n == 0) { cout << "No" << endl; } else if (e > 0 && w == 0) { cout << "No" << endl; } else if (w > 0 && e == 0) { cout << "No" << endl; } else { cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:9:23: error: 'S' was not declared in this scope 9 | for (int i = 0; i < S.size(); i++) { | ^ a.cc:10:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if (T.at(i) == "N") { | ~~~~~~~~^~~~~~ a.cc:13:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if (T.at(i) == "S") { | ~~~~~~~~^~~~~~ a.cc:16:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | if (T.at(i) == "E") { | ~~~~~~~~^~~~~~ a.cc:19:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 19 | if (T.at(i) == "W") { | ~~~~~~~~^~~~~~
s160137574
p04019
C++
#include<bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int n, s, e, w = 0; for (int i = 0; i < S.size(); i++) { if (S.at(i) == "N") { n++; } if (S.at(i) == "S") { s++; } if (S.at(i) == "E") { e++; } if (S.at(i) == "W") { w++; } } if (n > 0 && s == 0) { cout << "No" << endl; } else if (s > 0 && n == 0) { cout << "No" << endl; } else if (e > 0 && w == 0) { cout << "No" << endl; } else if (w > 0 && e == 0) { cout << "No" << endl; } else { cout << "Yes" << endl; } }
a.cc: In function 'int main()': a.cc:10:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if (S.at(i) == "N") { | ~~~~~~~~^~~~~~ a.cc:13:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if (S.at(i) == "S") { | ~~~~~~~~^~~~~~ a.cc:16:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | if (S.at(i) == "E") { | ~~~~~~~~^~~~~~ a.cc:19:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 19 | if (S.at(i) == "W") { | ~~~~~~~~^~~~~~
s818234276
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int a = S.size(); int TZ = 0; int NB = 0; int a, b, c, d; for(int i = 0; i < a; i++){ char H = S[i]; if(S[i] == 'N') a++; else if(S[i] == 'S') b--; else if (S[i] == 'W') c++; else d--; } if(a > 0 && b > 0 && c > 0 && d > 0){ cout << "Yes" << endl; } else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:10:7: error: redeclaration of 'int a' 10 | int a, b, c, d; | ^ a.cc:7:7: note: 'int a' previously declared here 7 | int a = S.size(); | ^
s527143775
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int a = S.size(); int TZ = 0; int NB = 0; int a, b, c, d; for(int i = 0; i < a; i++){ char H = S[i]; if(S[i] == 'N') a++; else if(S[i] == 'S') b--; else if (S[i] == 'W') c++; else d--; } if(a > 0 && b > 0 && c > 0 && d > 0;){ cout << "Yes" << endl; } else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:10:7: error: redeclaration of 'int a' 10 | int a, b, c, d; | ^ a.cc:7:7: note: 'int a' previously declared here 7 | int a = S.size(); | ^ a.cc:19:39: error: expected primary-expression before ')' token 19 | if(a > 0 && b > 0 && c > 0 && d > 0;){ | ^
s092452633
p04019
C++
int main() { string S; cin >> S; int a = S.size(); int TZ = 0; int NB = 0; for(int i = 0; i < a; i++){ char H = S[i]; if(S[i] == 'N') NB++; else if(S[i] == 'S') NB--; else if (S[i] == 'W') TZ++; else TZ--; } if(TZ == 0 && NB == 0){ cout << "Yes" << endl; } else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:3:3: error: 'string' was not declared in this scope 3 | string S; | ^~~~~~ a.cc:4:3: error: 'cin' was not declared in this scope 4 | cin >> S; | ^~~ a.cc:4:10: error: 'S' was not declared in this scope 4 | cin >> S; | ^ a.cc:17:5: error: 'cout' was not declared in this scope 17 | cout << "Yes" << endl; | ^~~~ a.cc:17:22: error: 'endl' was not declared in this scope 17 | cout << "Yes" << endl; | ^~~~ a.cc:19:8: error: 'cout' was not declared in this scope 19 | else cout << "No" << endl; | ^~~~ a.cc:19:24: error: 'endl' was not declared in this scope 19 | else cout << "No" << endl; | ^~~~
s133250597
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int a = S.size(); int TZ = 0; int NB = 0; for(int i = 0; i < a; i++){ if(S[i] == N) NB++; else if(S[i] == S) NB--; else if (S[i] == W) TZ++; else TZ--; } if(TZ == 0 && NB == 0){ cout << "Yes" << endl; } else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:11:15: error: 'N' was not declared in this scope 11 | if(S[i] == N) NB++; | ^ a.cc:12:18: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 12 | else if(S[i] == S) NB--; 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:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/regex.h:1199: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>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/regex.h:1274: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>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:12:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:12:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ 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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::pair<_T1, _T2>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::fpos<_StateT>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} 12 | else if(S[i] == S) NB--; | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:12:21: note: mismatched types 'const std::allocator<_CharT>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'cha
s820112527
p04019
C++
#include<bits/stdc++.h> using namespace std; #define int long long #define double long double #define fo(a,b) for(int a=0;a<b;a++) #define Sort(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define fi first #define se second #define sz size() #define bgn begin() #define en end() #define pb push_back #define pp() pop_back() #define V vector #define P pair #define yuko(a) setprecision(a) #define uni(a) a.erase(unique(a.begin(),a.end()),a.end()) #define Q queue #define pri priority_queue #define Pri priority_queue<int,vector<int>,greater<int>> #define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>> #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define all(a) (a).begin(),(a).end() #define elif else if int low(V<int> a,int b){ decltype(a)::iterator c=lower_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } int upp(V<int> a,int b){ decltype(a)::iterator c=upper_bound(a.begin(),a.end(),b); int d=c-a.bgn; return d; } template<class T> void cou(vector<vector<T>> a){ int b=a.size(); int c=a[0].size(); fo(i,b){ fo(j,c){ cout<<a[i][j]; if(j==c-1) cout<<endl; else cout<<' '; } } } int wari(int a,int b) { if(a%b==0) return a/b; else return a/b+1; } int keta(int a){ double b=a; b=log10(b); int c=b; return c+1; } int souwa(int a){ return a*(a+1)/2; } int gcm(int a,int b){ if(a%b==0) return b; return gcm(b,a%b); } bool prime(int a){ if(a<2) return false; else if(a==2) return true; else if(a%2==0) return false; for(int i=3;i<=sqrt(a)+1;i+=2){ if (a%i==0) return false; } return true; } struct Union{ vector<int> par; Union(int a){ par=vector<int>(a,-1); } int find(int a){ if(par[a]<0) return a; else return par[a]=find(par[a]); } bool same(int a,int b){ return find(a)==find(b); } int Size(int a){ return -par[find(a)]; } void unite(int a,int b){ a=find(a); b=find(b); if(a==b) return; if(Size(b)>Size(a)) swap<int>(a,b); par[a]+=par[b]; par[b]=a; } }; int ketas(int a){ string b=to_string(a); int c=0; fo(i,keta(a)){ c+=b[i]-'0'; } return c; } bool fe(int a,int b){ a%=10; b%=10; if(a==0) a=10; if(b==0) b=10; if(a>b) return true; else return false; } int INF=1000000007; struct edge{int s,t,d; }; V<int> mojisyu(string a){ V<int> b(26,0); fo(i,a.sz){ b[a[i]-'a']++; } return b; } int wa2(int a){ if(a%2==1) return a/2; return a/2-1; } /*signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } } ?*/ int nCr(int n,int r){ if(n<r) return 0; int a=1; r=min(r,n-r); for(int i=n;i>n-r;i--){ a*=i; a/=n-i+1; } return a; } /*void sea(int x,int y){ if(x<0||a<=x||y<0||b<=y||c[x][y]=='#') return; if(d[x][y]) return; d[x][y]++; sea(x+1,y); sea(x-1,y); sea(x,y+1); sea(x,y-1); }*/ int kaijou(int a){ int b=1; fo(i,a) b*=i+1; return b; } int nPr(int a,int b){ if(a<b) return 0; if(b==0) return 1; int c=1; for(int i=a;i>a-b;i--){ c*=i; c%=INF; } return c; } int modinv(int a,int m){ int b=m,u=1,v=0; while(b){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } u%=m; if(u<0) u+=m; return u; } int lcm(int a,int b){ int c=modinv(gcm(a,b),INF); return ((a*c)%INF)*(b%INF)%INF; } int MOD=INF; int fac[1000010], finv[1000010], inv[1000010]; // テーブルを作る前処理 //先にCOMinit()で前処理をする //ABC145D void COMinit() { fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<1000010;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; } } // 二項係数計算 int 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; } bool naka(int a,int b,V<V<char>> c){ return (a>=0&&b>=0&&a<c.sz&&b<c[0].sz); } V<P<int,int>> mawari8={{0,-1},{0,1},{1,0},{-1,0},{-1,-1},{1,1},{1,-1},{-1,-1}}; int inf=1000000000000000007; /* signed main(){ int a,b,c; cin>>a>>b>>c; V<V<edge>> d(a); fo(i,b){ edge e; cin>>e.s>>e.t>>e.d; d[e.s].pb(e); } V<int> e(a,INF); e[c]=0; priority_queue<P<int,int>,V<P<int,int>>,greater<P<int,int>>> f; f.push({0,c}); int h=INF; while(!f.empty()){ P<int,int> g; g=f.top(); f.pop(); int v = g.second, i = g.first; for(edge l : d[v]){ if(e[l.t] > i + l.d){ e[l.t] = i + l.d; f.push({i+l.d , l.t}); } } } fo(i,a){ if(e[i]==INF) cout<<"INF"<<endl; else cout<<e[i]<<endl; } }*/ V<P<int,int>> mawari4={{0,-1},{0,1},{1,0},{-1,0}}; //最短経路の表 a(全部INFで初期化) //縦横 x,y //迷路 f //スタートsx,sy //ゴールgx,gy //文字はgから使おうね /*int bfs_haba(){ Q<P<int,int>> b; a[sx][sy]=0; b.push({sx,sy}); while(!b.empty()){ P<int,int> c=b.front(); b.pop(); if(c.fi==gx&&c.se==gy){ break; } fo(i,4){ int d=c.fi+mawari4[i].fi; int e=c.se+mawari4[i].se; if(0<=d&&0<=e&&d<x&&e<y&&f[d][e]!='#'&&a[d][e]==INF){ b.push({d,e}); a[d][e]=1+a[c.fi][c.se]; } } } return a[gx][gy]; }*/ V<int> onajibubun(string a){ V<int> b(a.sz); for(int i=1,j=0;i<a.sz;i++){ if(i+b[i-j]<j+b[j]) b[i]=b[i-j]; else{ int c=max<int>(0,j+b[j]-i); while(i+c<a.sz&&a[c]==a[i+c]) c++; b[i]=c; j=i; } } b[0]=a.sz; return b; } //各頂点ごとにどこに辺が出てるかの表がc //各頂点ごとの色を表すV<int>(頂点数max)のcolorを用意する //aはどこ塗るか、bは何で塗るかなので、(0,1,c)でよぶとおけ V<int> color(205); bool nibu_hantei(int a,int b,V<V<int>> c){ color[a]=b; fo(i,c[a].sz){ if(b==color[c[a][i]]) return false; if(color[c[a][i]]==0&&!nibu_hantei(c[a][i],-b,c)) return false; } return true; } //aは頂点数 //nibu_hanteiの上にcolorを用意する //各頂点ごとにどこに辺が出てるかの表がc bool renketujanai_nibu_hantei(int a,V<V<int>> c){ fo(i,a){ if(color[i]==0){ if(!nibu_hantei(i,1,c)) return false; } } return true; } signed main(){ string s; cin>>s; Sort(s); int a,b,c,d; fo(1,s.size()){ if(s[i]=='S') a++; if(s[i]=='N') b++; if(s[i]=='E') c++; if(s[i]=='W') d++; } if(a>0&&b==0) cout<<"No"<<endl; else if(b>0&&a==0) cout<<"No"<<endl; else if(d>0&&c==0) cout<<"No"<<endl; else if(c>0&&d==0) cout<<"No"<<endl; else cout<<"Yes"<<endl; }
a.cc: In function 'int main()': a.cc:382:6: error: expected unqualified-id before numeric constant 382 | fo(1,s.size()){ | ^ a.cc:5:25: note: in definition of macro 'fo' 5 | #define fo(a,b) for(int a=0;a<b;a++) | ^ a.cc:382:6: error: expected ';' before numeric constant 382 | fo(1,s.size()){ | ^ a.cc:5:25: note: in definition of macro 'fo' 5 | #define fo(a,b) for(int a=0;a<b;a++) | ^ a.cc:382:6: error: lvalue required as left operand of assignment 382 | fo(1,s.size()){ | ^ a.cc:5:25: note: in definition of macro 'fo' 5 | #define fo(a,b) for(int a=0;a<b;a++) | ^ a.cc:5:32: error: expected ')' before ';' token 5 | #define fo(a,b) for(int a=0;a<b;a++) | ~ ^ a.cc:382:3: note: in expansion of macro 'fo' 382 | fo(1,s.size()){ | ^~ a.cc:382:6: error: lvalue required as increment operand 382 | fo(1,s.size()){ | ^ a.cc:5:33: note: in definition of macro 'fo' 5 | #define fo(a,b) for(int a=0;a<b;a++) | ^
s829430013
p04019
C++
#include <bits/stdc++.h> #define rep(i,n)for(long long i=0;i<(n);i++) using namespace std; using P=pair<int,int>; typedef unsigned long long ull; typedef long long ll; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } const ll MOD=1e9+7; const double pi=acos(-1); int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int main(){ cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n=0,s=0,e=0,w=0; rep(i,s.size()){ if(s[i]=='N')n++; if(s[i]=='S')s++; if(s[i]=='E')e++; if(s[i]=='W')w++; } if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ cout << "No" << endl; } else cout << "Yes" << endl; }
a.cc: In function 'int main()': a.cc:21:11: error: conflicting declaration 'int s' 21 | int n=0,s=0,e=0,w=0; | ^ a.cc:19:10: note: previous declaration as 'std::string s' 19 | string s; | ^ a.cc:24:19: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 24 | if(s[i]=='S')s++; | ~^~ a.cc:28:15: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ~^~~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1199: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>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:28:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1274: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>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:28:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:28:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ 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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const
s978453388
p04019
C++
#include <bits/stdc++.h> #define rep(i,n)for(long long i=0;i<(n);i++) using namespace std; using P=pair<int,int>; typedef unsigned long long ull; typedef long long ll; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } const ll MOD=1e9+7; const double pi=acos(-1); int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int main(){ cin.tie(0); ios::sync_with_stdio(false); string s; cin >> s; int n=0,s=0,e=0,w=0 rep(i,s.size()){ if(s[i]=='N')n++; if(s[i]=='S')s++; if(s[i]=='E')e++; if(s[i]=='W')w++; } if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ cout << "No" << endl; } else cout << "Yes" << endl; }
a.cc: In function 'int main()': a.cc:21:11: error: conflicting declaration 'int s' 21 | int n=0,s=0,e=0,w=0 | ^ a.cc:19:10: note: previous declaration as 'std::string s' 19 | string s; | ^ a.cc:2:17: error: expected ',' or ';' before 'for' 2 | #define rep(i,n)for(long long i=0;i<(n);i++) | ^~~ a.cc:22:3: note: in expansion of macro 'rep' 22 | rep(i,s.size()){ | ^~~ a.cc:22:7: error: 'i' was not declared in this scope 22 | rep(i,s.size()){ | ^ a.cc:2:35: note: in definition of macro 'rep' 2 | #define rep(i,n)for(long long i=0;i<(n);i++) | ^ a.cc:28:15: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ~^~~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1199: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>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:28:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1274: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>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:28:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:28:17: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ 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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | if((n>0 && s==0)||(s>0 && n==0)||(e>0 && w==0)||(w>0 && e==0)){ | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:28:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 28 | if((n>0 && s==0)||(s
s462206414
p04019
C++
#include <bits/stdc++.h> using namespace std; using ll =long long; #define For(i, a, b) for(int i = (a) ; i < (b) ; ++i) #define rep(i, n) For(i, 0, n) #define debug(x) cerr << #x << " = " << (x) << endl; #define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());} template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } static const ll INF = 1LL << 60; //Write From this Line #define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());} int main() { string s; cin >> s; leftunique(s); if(s.size() == 2 || s.size() == 4){ cout << "Yes" << endl; } else { cout << "No" << endl; } }
a.cc:13:9: warning: "leftunique" redefined 13 | #define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());} | ^~~~~~~~~~ a.cc:8:9: note: this is the location of the previous definition 8 | #define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());} | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:13:24: error: 'SORT' was not declared in this scope 13 | #define leftunique(a) {SORT(a);(a).erase(unique((a).begin(),(a).end()),(a).end());} | ^~~~ a.cc:19:9: note: in expansion of macro 'leftunique' 19 | leftunique(s); | ^~~~~~~~~~
s572507480
p04019
C++
#include<bits/stdc++.h> using namespace std; char s[1010]; int n,v1,v2,v3,v4; int main() { gets(s); n=strlen(s); for(int i=0;i<n;i++) { if(s[i]=='N')v1=1; if(s[i]=='W')v2=1; if(s[i]=='S')v3=1; if(s[i]=='E')v4=1; } if((v1^v3)||(v2^v3)) printf("No"); else printf("Yes"); }
a.cc: In function 'int main()': a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(s); | ^~~~ | getw
s193597978
p04019
C++
s = gets.chomp news = s.split('').uniq() ans = 'No' if news.length() == 4 && (news.include?('S') && news.include?('N') && news.include?('W') && news.include?('E')) ans = 'Yes' elsif news.length() == 2 && ((news.include?('S') && news.include?('N')) || (news.include?('W') && news.include?('E'))) ans = "Yes" end puts ans
a.cc:2:16: error: empty character constant 2 | news = s.split('').uniq() | ^~ a.cc:3:7: warning: multi-character character constant [-Wmultichar] 3 | ans = 'No' | ^~~~ a.cc:5:9: warning: multi-character character constant [-Wmultichar] 5 | ans = 'Yes' | ^~~~~ a.cc:1:1: error: 's' does not name a type 1 | s = gets.chomp | ^
s068602755
p04019
C++
#include<bits/stdc++.h> using namespace std; int main() { bool N=0,S=0,E=0,W=0; string S; cin >> S; for(int i=0;i<S.size();i++) { char b=S.at(i); if(b=='N')N=1; else if(b=='S')S=1; else if(b=='E')E=1; else if(b=='W')W=1; } if(N==S&&E==W)cout << "Yes" << endl; else{ cout << "No" << endl; } }
a.cc: In function 'int main()': a.cc:6:10: error: conflicting declaration 'std::string S' 6 | string S; | ^ a.cc:5:12: note: previous declaration as 'bool S' 5 | bool N=0,S=0,E=0,W=0; | ^ a.cc:8:19: error: request for member 'size' in 'S', which is of non-class type 'bool' 8 | for(int i=0;i<S.size();i++) | ^~~~ a.cc:10:14: error: request for member 'at' in 'S', which is of non-class type 'bool' 10 | char b=S.at(i); | ^~
s639417464
p04019
C++
#include <iostream> //#include <iomanip> #include <string> //#include <vector> //#include <algorithm> //#include <utility> //#include <set> //#include <map> //#include <queue> //#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> ; //ll mod = 1000000007 ; //long double pie = acos(-1) ; string yorn(bool a){if(a) return"Yes" ; return "No" ;} //string YorN(bool a){if(a) return"YES" ; return "NO" ;} //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 mysort(vector<long long> &a){sort(a.begin(),a.end()) ;} //void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;} int main(){ bool n,s,e,w ; n = s = e = w = false ; string s ; cin >> s ; for(int i=0;i<s.size();i++){ if(s.at(i)=='N') n = true ; if(s.at(i)=='S') s = true ; if(s.at(i)=='E') e = true ; if(s.at(i)=='W') w = true ; } cout << yorn((n==s)&&(e==w)) << endl ; }
a.cc: In function 'int main()': a.cc:37:16: error: conflicting declaration 'std::string s' 37 | string s ; cin >> s ; | ^ a.cc:35:16: note: previous declaration as 'bool s' 35 | bool n,s,e,w ; | ^ a.cc:38:25: error: request for member 'size' in 's', which is of non-class type 'bool' 38 | for(int i=0;i<s.size();i++){ | ^~~~ a.cc:39:22: error: request for member 'at' in 's', which is of non-class type 'bool' 39 | if(s.at(i)=='N') n = true ; | ^~ a.cc:40:22: error: request for member 'at' in 's', which is of non-class type 'bool' 40 | if(s.at(i)=='S') s = true ; | ^~ a.cc:41:22: error: request for member 'at' in 's', which is of non-class type 'bool' 41 | if(s.at(i)=='E') e = true ; | ^~ a.cc:42:22: error: request for member 'at' in 's', which is of non-class type 'bool' 42 | if(s.at(i)=='W') w = true ; | ^~
s030748043
p04019
Java
import java.util.Scanner; public class Main { public static void main(String args[]) { // 入力 Scanner sc = new Scanner(System.in); String s = sc.next(); // 主処理 boolean ns = true; if (0 <= s.indexOf("N") || 0 <= s.indexOf("S")) { ns = (0 <= s.indexOf("N") && 0 <= s.indexOf("S")); } boolean ew = true; if (0 <= s.indexOf("E") || 0 <= s.indexOf("W")) { ew = (0 <= s.indexOf("E") && 0 <= s.indexOf("W")); } String result = ns && ew ? "Yes" : "No"; // 出力 System.out.println(result); sc.close(); } }import java.util.Scanner; public class Main { public static void main(String args[]) { // 入力 Scanner sc = new Scanner(System.in); String s = sc.next(); // 主処理 boolean ns = true; if (0 <= s.indexOf("N") || 0 <= s.indexOf("S")) { ns = (0 <= s.indexOf("N") && 0 <= s.indexOf("S")); } boolean ew = true; if (0 <= s.indexOf("E") || 0 <= s.indexOf("W")) { ew = (0 <= s.indexOf("E") && 0 <= s.indexOf("W")); } String result = ns && ew ? "Yes" : "No"; // 出力 System.out.println(result); sc.close(); } }
Main.java:26: error: class, interface, enum, or record expected }import java.util.Scanner; ^ 1 error
s514089900
p04019
C++
#include <bits/stdc++.h> using namespace std; using lint = long; using ll = long long; #define rep(i,n) for(lint (i) = 0;(i) < (lint)(n);(i)++) #define repInRange(i,start,end) for(lint (i) = (start);(i) < (end);++(i)) using pl = pair<lint,lint>; using Vecint = vector<lint>; using Llist = list<lint>; ll pow(ll k,ll l) { ll ret = 1; rep(i,l) { ret *= k; } return ret; } template <typename T> T sum(vector<T> vec) { ll ret = 0; rep(i,vec.size()) { ret += vec.at(i); } return ret; } void Main() { string s; pl c(0,0); cin >> s; rep(i,s.size()) { switch s[i] { case 'N': c.second++; break; case 'E': c.first++; break; case 'W': c.first--; break; case 'S': c.second--; break; } } if (!((c.first())&(c.second()))) { cout << "Yes" << '\n'; return; } cout << "No" << '\n'; return; } signed main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }
a.cc: In function 'void Main()': a.cc:33:24: error: expected '(' before 's' 33 | switch s[i] { | ^ | ( a.cc:48:23: error: expression cannot be used as a function 48 | if (!((c.first())&(c.second()))) { | ~~~~~~~^~ a.cc:48:36: error: expression cannot be used as a function 48 | if (!((c.first())&(c.second()))) { | ~~~~~~~~^~
s916526163
p04019
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int n,e,s,w; char ch; scanf("%c",&ch"); for(int i=1;i<=ch.size;i++) { if(ch[i]='W') { w++; } if(ch[i]='N') { n++; } if(ch[i]='E') { e++; } if(ch[i]='S') { s++; } } if(n-s==0&&e-w==0) { cout<<"Yes"; } else { cout<<"No"; } return 0; }
a.cc:9:19: warning: missing terminating " character 9 | scanf("%c",&ch"); | ^ a.cc:9:19: error: missing terminating " character 9 | scanf("%c",&ch"); | ^~~ a.cc: In function 'int main()': a.cc:9:19: error: expected ')' before 'for' 9 | scanf("%c",&ch"); | ~ ^ | ) 10 | for(int i=1;i<=ch.size;i++) | ~~~ a.cc:10:17: error: 'i' was not declared in this scope 10 | for(int i=1;i<=ch.size;i++) | ^ a.cc:10:23: error: request for member 'size' in 'ch', which is of non-class type 'char' 10 | for(int i=1;i<=ch.size;i++) | ^~~~
s772886161
p04019
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int n,e,s,w; char ch; scanf("%c,&ch"); for(int i=1;i<=ch.size;i++) { if(ch[i]='W') { w++; } if(ch[i]='N') { n++; } if(ch[i]='E') { e++; } if(ch[i]='S') { s++; } } if(n-s==0&&e-w==0) { cout<<"Yes"; } else { cout<<"No"; } return 0; }
a.cc: In function 'int main()': a.cc:10:23: error: request for member 'size' in 'ch', which is of non-class type 'char' 10 | for(int i=1;i<=ch.size;i++) | ^~~~ a.cc:12:14: error: invalid types 'char[int]' for array subscript 12 | if(ch[i]='W') | ^ a.cc:16:14: error: invalid types 'char[int]' for array subscript 16 | if(ch[i]='N') | ^ a.cc:20:14: error: invalid types 'char[int]' for array subscript 20 | if(ch[i]='E') | ^ a.cc:24:14: error: invalid types 'char[int]' for array subscript 24 | if(ch[i]='S') | ^
s406200411
p04019
C++
var w,n,e,s:longint; x:char; begin while not eoln do begin read(x); case x of 'W':w:=1; 'N':n:=1; 'E':e:=1; 'S':s:=1; end; end; if (w=e) and (n=s) then writeln('Yes') else writeln('No'); end.
a.cc:15:13: warning: multi-character character constant [-Wmultichar] 15 | writeln('Yes') | ^~~~~ a.cc:17:13: warning: multi-character character constant [-Wmultichar] 17 | writeln('No'); | ^~~~ a.cc:1:1: error: 'var' does not name a type 1 | var w,n,e,s:longint; | ^~~ a.cc:2:5: error: 'x' does not name a type 2 | x:char; | ^ a.cc:3:1: error: 'begin' does not name a type 3 | begin | ^~~~~ a.cc:7:5: error: expected unqualified-id before 'case' 7 | case x of | ^~~~ a.cc:9:7: error: expected unqualified-id before 'N' 9 | 'N':n:=1; | ^~~ a.cc:10:7: error: expected unqualified-id before 'E' 10 | 'E':e:=1; | ^~~ a.cc:11:7: error: expected unqualified-id before 'S' 11 | 'S':s:=1; | ^~~ a.cc:12:5: error: 'end' does not name a type 12 | end; | ^~~ a.cc:13:3: error: 'end' does not name a type 13 | end; | ^~~ a.cc:14:3: error: expected unqualified-id before 'if' 14 | if (w=e) and (n=s) then | ^~ a.cc:18:1: error: 'end' does not name a type 18 | end. | ^~~
s608452029
p04019
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; int w,e,s,n; cin>>s; for(int i=0;i<s.size();i++) { if(s[i]=='W')w=1; else if(s[i]=='E')e=1; else if(s[i]=='S')s=1; else n=1; } if(w==e&&n==s)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:17: error: conflicting declaration 'int s' 6 | int w,e,s,n; | ^ a.cc:5:16: note: previous declaration as 'std::string s' 5 | string s; | ^ a.cc:15:19: error: no match for 'operator==' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ~^~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | 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:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/regex.h:1199: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>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/regex.h:1274: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>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:15:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:15:21: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::__cxx11::match_results<_BiIter, _Alloc>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<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:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::fpos<_StateT>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<endl; | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:15:21: note: mismatched types 'const std::allocator<_CharT>' and 'int' 15 | if(w==e&&n==s)cout<<"YES"<<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:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution faile
s328483780
p04019
C++
#include<bits/stdc++.h> using namespace std; int b,l; string s; int main(){ cin>>s; l=s.length(); for(register int i=0;i<l;++i){ if(s[i]=='S'){ b=0; for(register int i=0;i<l;++i)if(a[i]=='N'){ b=1; break; } if(!b){ puts("No"); return 0; } }if(s[i]=='N'){ b=0; for(register int i=0;i<l;i++)if(a[i]=='S'){ b=1; break; }if(!b){ puts("No"); return 0; } }if(s[i]=='E'){ b=0; for(register int i=0;i<l;i++)if(a[i]=='W'){ b=1; break; } if(!b){ puts("No"); return 0; } }if(s[i]=='W'){ b=0; for(register int i=0;i<l;i++)if(a[i]=='E'){ b=1; break; }if(!b){ puts("No"); return 0; } } } puts("Yes"); return 0; }
a.cc: In function 'int main()': a.cc:8:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 8 | for(register int i=0;i<l;++i){ | ^ a.cc:11:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 11 | for(register int i=0;i<l;++i)if(a[i]=='N'){ | ^ a.cc:11:45: error: 'a' was not declared in this scope 11 | for(register int i=0;i<l;++i)if(a[i]=='N'){ | ^ a.cc:21:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 21 | for(register int i=0;i<l;i++)if(a[i]=='S'){ | ^ a.cc:21:45: error: 'a' was not declared in this scope 21 | for(register int i=0;i<l;i++)if(a[i]=='S'){ | ^ a.cc:30:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 30 | for(register int i=0;i<l;i++)if(a[i]=='W'){ | ^ a.cc:30:45: error: 'a' was not declared in this scope 30 | for(register int i=0;i<l;i++)if(a[i]=='W'){ | ^ a.cc:40:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 40 | for(register int i=0;i<l;i++)if(a[i]=='E'){ | ^ a.cc:40:45: error: 'a' was not declared in this scope 40 | for(register int i=0;i<l;i++)if(a[i]=='E'){ | ^