submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s855353857 | p03954 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,a[20000010];
bool x(int i,int j,int k) {
return a[i]<=k&&a[j]<=k;
}
bool y(int i,int j,int k){
return a[i]>k&&a[j]>k;
}
bool check(int a){
for(int i=0;i<n-1;i++){
if(y(n+i,n+i+1,a)||y(n-i,n-i-1,a)) return 0;
if(x(n+i,n+i+1,a)||x(n-i,n-i-1,a)) return 1;
}
return smaller(1,1,k);
}
int main(){
scanf("%d",&n);
for(int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
int l=1,r=2*n-1,mid;
while(l<r){
mid=(l+r)/2;
if(check(mid)) r=mid;
else l=mid+1;
}
printf("%d",l);
return 0;
} | a.cc: In function 'bool check(int)':
a.cc:15:24: error: 'k' was not declared in this scope
15 | return smaller(1,1,k);
| ^
a.cc:15:12: error: 'smaller' was not declared in this scope
15 | return smaller(1,1,k);
| ^~~~~~~
|
s392833847 | p03954 | C++ | #include<bits/stdc++.h>
const int maxn=200005;
int n,a[maxn],b[maxn];
inline bool check(int k){
for(int i=1;i<=2*n-1;i++) b[i]=(a[i]>=k);
int l=n,r=n;
while(l>1&&b[l-1]!=b[l]) l--;
while(r<2*n-1&&b[r+1]!=b[r]) r++;
if(l==1&&r==2*n-1) return (n&1)?b[n]:(b[n]^1);
return n-l<r-n?b[l]:b[r];
}
int main(){
sacnf("%d",&d);
fo(int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
int l=1,r=2*n-1,ans;
while(l<=r){
int md=(l+r)>>1;
if(check(md)){
ans=md;
l=md+1;
}
else r=md-1;
}
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:13:21: error: 'd' was not declared in this scope
13 | sacnf("%d",&d);
| ^
a.cc:13:9: error: 'sacnf' was not declared in this scope; did you mean 'scanf'?
13 | sacnf("%d",&d);
| ^~~~~
| scanf
a.cc:14:12: error: expected primary-expression before 'int'
14 | fo(int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
| ^~~
a.cc:14:20: error: 'i' was not declared in this scope
14 | fo(int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
| ^
|
s633169759 | p03954 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <algorithm>
using namespace std;
#define Rep(i,l,r) for (int i = (l); i <= (r); ++ i)
#define RepD(i,r,l) for (int i = (r); i >= (l); -- i)
#define RepG(i,x) for (int i = hd[x]; i; i = e[i].nxt)
int main () {
cin >> n; cout << n << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:16: error: 'n' was not declared in this scope; did you mean 'yn'?
15 | cin >> n; cout << n << endl;
| ^
| yn
|
s194281050 | p03954 | C++ | # include <cstdio>
# define REP(i, n) for (int i = 1; i <= n; ++ i)
# define REP_0(i, n) for (int i = 0; i < n; ++ i)
# define FOR(i, a, b) for (int i = a; i <= b; ++ i)
# define NR 201000
bool a[NR];
int w[NR], n, m;
bool calc_top () {
int p = 0;
//REP (i, n) printf ("%d ", a[i]); puts (" Beg");
FOR (i, 2, n) {
if (a[i] == a[i - 1]) {
int l = p + 1, r = i - 2;
if (l <= r) {
int len = r - l + 1;
if (len % 2 == 0) {
REP_0 (j, len) {
if (j < len / 2) a[l + j] = a[l - 1];
else a[l + j] = a[r + 1];
}
} else FOR (j, l, r) a[j] = a[r + 1];
}
p = i;
}
}
int l = p + 1, r = len;
if (len % 2 == 0) {
REP_0 (j, len) {
if (j < len / 2) a[l + j] = a[l - 1];
else a[l + j] = a[r + 1];
}
} else FOR (j, l, r) a[j] = a[l - 1];
//REP (i, n) printf ("%d ", a[i]); puts (" End");
return p == 0 ? a[1] : a[m];
}
int main () {
scanf ("%d", &m);
n = 2 * m - 1;
REP (i, n) {
scanf ("%d", &w[i]);
}
int l = 1, r = n;
for (; l < r; ) {
int mid = (l + r + 1) / 2;
REP (i, n) a[i] = (w[i] >= mid);
//printf ("!%d\n", mid);
if (calc_top ()) l = mid;
else r = mid - 1;
}
printf ("%d\n", l);
return 0;
}
| a.cc: In function 'bool calc_top()':
a.cc:32:28: error: 'len' was not declared in this scope
32 | int l = p + 1, r = len;
| ^~~
|
s109624334 | p03954 | C++ | # include <cstdio>
# define REP(i, n) for (int i = 1; i <= n; ++ i)
# define REP_0(i, n) for (int i = 0; i < n; ++ i)
# define FOR(i, a, b) for (int i = a; i <= b; ++ i)
# define NR 201000
bool a[NR];
int w[NR], n, m;
bool calc_top () {
int p = 0;
FOR (i, 2, n) {
if (s[i] == s[i - 1]) {
int l = p + 1, r = i - 2;
if (l <= r) {
int len = r - l + 1;
if (len % 2 == 0) {
REP_0 (j, len) {
if (j < len / 2) a[l + j] = a[l - 1];
else a[l + j] = a[r + 1];
}
} else FOR (j, l, r) a[j] = a[r + 1];
}
}
}
return p == 0 ? a[1] : a[m];
}
int main () {
scanf ("%d", &m);
n = 2 * m - 1;
REP (i, n) {
scanf ("%d", &w[i]);
}
int l = 1, r = n;
for (; l < r; ) {
int mid = (l + r) / 2;
REP (i, n) a[i] = (w[i] >= mid);
}
printf ("%d\n", l);
return 0;
}
| a.cc: In function 'bool calc_top()':
a.cc:15:21: error: 's' was not declared in this scope
15 | if (s[i] == s[i - 1]) {
| ^
|
s293370569 | p03954 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>
using namespace std;
typedef long long ll;
typedef long double ld;
ll big = 1000000007ll;
float likeabutterfly;
string likeabee;
ll n,m,q,h,k,w;
ll T;
vector<ll> A;
ll look = 0;
bool mono(){
bool inc = 1;
bool dec = 1;
for(ll c1 = 0; c1 < A.size()-1; c1++){
if(A[c1] >= A[c1+1])inc = 0;
if(A[c1] <= A[c1+1])dec = 0;
}
return (dec || inc);
}
ll med(ll x, ll y, ll z){
if(x >= min(z,y) && x <= max(z,y))return x;
if(y >= min(z,x) && y <= max(z,x))return y;
if(z >= min(x,y) && z <= max(x,y))return z;
return x;
}
vector<ll> C;
void solve(){
if(mono()){
cout << A[look-1] << "\n";
return;
}
C.clear();
for(ll c1 = 1; c1 < A.size()-1; c1++){
C.push_back(med(A[c1-1] , A[c1] , A[c1+1]));
}
ll l = 0;
look--;
for(ll c1 = 0; c1 < min(look,C.size()-1); c1++){
if(C[c1] == C[c1+1])l = c1;
}
ll r = C.size()-1;
for(ll c1 = look; c1 < C.size()-1; c1++){
if(C[c1] == C[c1+1]){r = c1+1;break;}
}
A.clear();
for(ll c1 = l; c1 <= r; c1++){
A.push_back(C[c1]);
}
look -= l;
solve();
}
int main()
{
ll c1,c2,c3,c4,c5,c6;
ll a,b,d,e,c;
ll x,y,z;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
cin >> n;
look = n;
for(c1 = 0; c1 < 2*n-1; c1++){
cin >> a;
A.push_back(a);
}
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:78:24: error: no matching function for call to 'min(ll&, std::vector<long long int>::size_type)'
78 | for(ll c1 = 0; c1 < min(look,C.size()-1); c1++){
| ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:78:24: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'})
78 | for(ll c1 = 0; c1 < min(look,C.size()-1); c1++){
| ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:78:24: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
78 | for(ll c1 = 0; c1 < min(look,C.size()-1); c1++){
| ~~~^~~~~~~~~~~~~~~~~
|
s313158247 | p03954 | C++ | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
using namespace std;
int mid(int a, int b, int c)
{
if (a <= b && b <= c) {
return b;
} else if (b <= a && a <= c) {
return a;
} else {
return c;
}
}
int main()
{
int N;
scanf("%d", &N);
vector<int> a(N);
REP (i, N) {
scanf("%d", &a[i]);
}
if (N == 2) {
printf("2\n");
} else {
int left = mid(a[N - 2], a[N - 1], a[N]);
int mid = mid(a[N], a[N - 1], a[N + 1]);
int right = mid(a[N], a[N + 1], a[N + 2]);
if (left == mid) {
printf("%d\n", mid);
} else if (mid == right) {
printf("%d\n", mid);
}
}
} | a.cc: In function 'int main()':
a.cc:30:22: error: 'mid' cannot be used as a function
30 | int mid = mid(a[N], a[N - 1], a[N + 1]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:31:24: error: 'mid' cannot be used as a function
31 | int right = mid(a[N], a[N + 1], a[N + 2]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
|
s997137631 | p03954 | C++ | #include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
int Median(int a,int b, int c){
if(a>b && b>c){
return b;
}else if(c>b && b>a){
return b;
}
if(b>a && a>c){
return a;
}else if(c>a &&a>b){
return a;
}
if(b>c && c>a){
return c;
}else if( a>c && c>b){
return c;
}
}
int main(){
int N;
cin>>N;
vector<int> a(2*N-1);
for(int i=0;i<2*N-1;i++){
cin>>a[i];
}
vector<int> before(2*N-1);
int ret=0;
for(int i=N;i>1;i--){
vector<int> next(2*i-1);
for(int j=1;j<2*i-2;j++){
//cout<<i<<" "<<j<<endl;
if(i==N){
//next[j]=min(max(a[j-1],a[j]),max(a[j],a[j+1]));
next[j]=Median(a[j-1],a[j],a[j+1]);
}else{
//next[j]=min(max(before[j-1],before[j]),max(before[j],before[j+1]));
next[j]=Median(next[j-1],next[j],next[j+1]);
}
}
if(i<=2){
ret=Median(next[1],next[2],next[3]));
}
//cout<<endl;
}
if(N<3){
cout<<Median(a[0],a[1],a[2])<<endl;
}else{
cout<<ret<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:58:60: error: expected ';' before ')' token
58 | ret=Median(next[1],next[2],next[3]));
| ^
| ;
a.cc: In function 'int Median(int, int, int)':
a.cc:34:1: warning: control reaches end of non-void function [-Wreturn-type]
34 | }
| ^
|
s498973668 | p03954 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x << endl
#define N 200005
#define newLine printf("\n");
#define sll(X) scanf("%lld", &X);
#define pll(X) printf("%lld", X);
#define printAll(X, n) for(int i=0;i<n;i++) printf("%lld ", X[i]); newLine;
#define scanAll(X, n) for(int i=0;i<n;i++) scanf("%lld", &X[i]);
int getMedian(int a, int b, int c)
{
std::vector<int> v;
v.clear();
v.push_back(a);
v.push_back(b);
v.push_back(c);
sort(v.begin(), v.end());
return v[1];
}
ll n, arr[200005];
std::vector<int> x, eles[2];
set<int> st;
int main() {
sll(n);
scanAll(arr, 2*n - 1);
int ind = n - 1;
for(int i = 0; i < 2*n - 3; i++)
{
x.push_back(getMedian(arr[i], arr[i + 1], arr[i + 2]));
// cout << i << " " << ind << "\n";
if(i >= ind - 1 && i <= ind + 1)
{
// cout << arr[i] << " " ;
eles[0].push_back(arr[i]);
}
}
// for(int i = 0; i < x.size(); i++)
// cout << x[i] << " ";
// cout << "\n";
ind--;
for(int i = ind - 1; i <= ind + 1; i++)
{
// cout << x[i] << " " ;
for(int j = 0; j < 3; j++)
{
if(eles[0][j] == x[i])
{
st.insert(x[i]);
}
}
}
if(st.size() == 1)
{
printf("%d\n",*st.begin() );
return 0;
}
return 1;
else if(st.size() >= 2)
{
printf("%d\n", getMedian(x[ind - 1], x[ind], x[ind + 1]));
return 0;
}
return 1;
} | a.cc: In function 'int main()':
a.cc:73:9: error: 'else' without a previous 'if'
73 | else if(st.size() >= 2)
| ^~~~
|
s054941501 | p03954 | Java |
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <queue>
using namespace std;
#define ll long long
#define MOD 1000000007LL
class Main {
public:
int topNum(vector<int>& as) {
vector<int> oldVec = as;
vector<int> newVec;
for (int i = (as.size() + 1) / 2;i >= 2;i--) {
newVec.clear();
for (int j = 1;j <= oldVec.size() - 2;j++) {
newVec.push_back(median3(oldVec[j - 1], oldVec[j], oldVec[j + 1]));
}
oldVec = newVec;
}
return newVec[0];
}
int median3(int x, int y, int z)
{
if (x < y) {
if (y < z) {
return y;
}
else if (z < x) {
return x;
}
return z;
}
else {
if (z < y) {
return y;
}
else if (x < z) {
return x;
}
return z;
}
}
};
int main()
{
Main m;
int n;
vector<int> as;
cin >> n;
for (int i = 0;i < 2 * n - 1;i++) {
int inp;
cin >> inp;
as.push_back(inp);
}
cout << m.topNum(as) << endl;
return 0;
}
| Main.java:2: error: illegal character: '#'
#include <string>
^
Main.java:3: error: illegal character: '#'
#include <sstream>
^
Main.java:4: error: illegal character: '#'
#include <iostream>
^
Main.java:5: error: illegal character: '#'
#include <vector>
^
Main.java:6: error: illegal character: '#'
#include <math.h>
^
Main.java:7: error: illegal character: '#'
#include <algorithm>
^
Main.java:8: error: illegal character: '#'
#include <functional>
^
Main.java:9: error: illegal character: '#'
#include <map>
^
Main.java:10: error: illegal character: '#'
#include <climits>
^
Main.java:11: error: illegal character: '#'
#include <queue>
^
Main.java:15: error: illegal character: '#'
#define ll long long
^
Main.java:15: error: class, interface, enum, or record expected
#define ll long long
^
Main.java:16: error: illegal character: '#'
#define MOD 1000000007LL
^
Main.java:20: error: illegal start of type
public:
^
Main.java:21: error: <identifier> expected
int topNum(vector<int>& as) {
^
Main.java:66: error: not a statement
cin >> n;
^
Main.java:69: error: not a statement
cin >> inp;
^
Main.java:73: error: not a statement
cout << m.topNum(as) << endl;
^
Main.java:60: error: unnamed classes are a preview feature and are disabled by default.
int main()
^
(use --enable-preview to enable unnamed classes)
19 errors
|
s157060322 | p03955 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
_do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
_s<<"{";
for(It _it=_ita;_it!=_itb;_it++)
{
_s<<(_it==_ita?"":",")<<*_it;
}
_s<<"}";
return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;
int d[3][MAXn];
vector<ii> data;
int bit1[MAXn],bit2[MAXn];
int pos[MAXn];
int lowbit(int x){return x&(-x);}
void ins(int x,int *bit){
for (x++;x;x-=lowbit(x)) bit[x]++;
}
int qr(int x,int *bit){
int ret = 0;
for (x++;x<MAXn;x+=lowbit(x)) ret += bit[x];
return ret;
}
int main(){
int n;
cin >> n;
for (int i=0;i<3;++i) {
for (int j=0;j<n;++j) {
cin >> d[i][j];
}
}
for (int i=0;i<n;++i) {
if ((d[1][i]-2) % 3 != 0) return cout << "No" << endl,0;
}
for (int i=0;i<n;++i) {
vector<int> tmp;
for (int j=0;j<3;++j) tmp.eb(d[j][i]);
sort(ALL(tmp));
debug(tmp);
for (int j=0;j<3;++j) {
if ((tmp[j]-1) % 3 != j) return cout << "No" << endl,0;
}
int cur = (tmp[0]-1) / 3;
if (cur % 2 != i % 2) return cout << "No" << endl,0;
int rev = 1;
if (d[0][i] < d[2][i]) rev = 0;
data.eb(cur,rev);
pos[cur] = i;
}
int flip1 = 0, flip2 = 0, inv1 = 0, inv2 = 0;
for (int i=0;i<n;++i) {
ii tmp = data[pos[i]];
if (i&1) {
flip2 += tmp.Y;
inv2 += qr(pos[tmp.X],bit2);
ins(pos[tmp.X],bit2);
}
else {
flip1 += tmp.Y;
inv1 += qr(pos[tmp.X],bit1);
ins(pos[tmp.X],bit1);
}
debug(pos[tmp.X],tmp.X);
}
debug(flip1,flip2,inv1,inv2);
if (flip1 % 2 == inv2 % 2 && flip2 % 2 == inv1 % 2) cout << "Yes" << endl;
else cout << "No" << endl;
}
| a.cc: In function 'int main()':
a.cc:89:9: error: reference to 'data' is ambiguous
89 | data.eb(cur,rev);
| ^~~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:53:12: note: 'std::vector<std::pair<int, int> > data'
53 | vector<ii> data;
| ^~~~
a.cc:95:18: error: reference to 'data' is ambiguous
95 | ii tmp = data[pos[i]];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:53:12: note: 'std::vector<std::pair<int, int> > data'
53 | vector<ii> data;
| ^~~~
|
s071554896 | p03955 | C++ | #include<bits/stdc++.h>
#define re register
using namespace std;
const int MAXN=1e5+5;
int N,swtch[2],matrix[5][MAXN],temp[MAXN];
int main(){
cin>>N;
for(re int i=1;i<=3;i++) for(re int j=1;j<=N;j++) cin>>matrix[i][j];
for(re int i=1;i<=N;i++){
temp[i]=matrix[2][i]/3+1;
if(!((matrix[1][i]-matrix[2][i]==-1 && matrix[2][i]-matrix[3][i]==-1
&& matrix[1][i]%3==1) || (matrix[1][i]-matrix[2][i]==1
&& matrix[2][i]-matrix[3][i]==1
&& !(matrix[1][i]%3))) || (abs(i-temp[i])&1)){cout<<"No"<<endl; return 0;}
swtch[i&1]^=(matrix[1][i]>matrix[2][i]);
}
for(re int i=1;i<=N;i++){while(temp[i]!=i){swtch[i&1^1]^=1; swap(temp[i],temp[temp[i]]);}}
cout<<swtch[0]||swtch[1] ? "No" : "Yes"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
8 | for(re int i=1;i<=3;i++) for(re int j=1;j<=N;j++) cin>>matrix[i][j];
| ^
a.cc:8:41: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
8 | for(re int i=1;i<=3;i++) for(re int j=1;j<=N;j++) cin>>matrix[i][j];
| ^
a.cc:9:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
9 | for(re int i=1;i<=N;i++){
| ^
a.cc:17:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
17 | for(re int i=1;i<=N;i++){while(temp[i]!=i){swtch[i&1^1]^=1; swap(temp[i],temp[temp[i]]);}}
| ^
a.cc:18:48: error: invalid operands of types 'const char [4]' and '<unresolved overloaded function type>' to binary 'operator<<'
18 | cout<<swtch[0]||swtch[1] ? "No" : "Yes"<<endl;
| ~~~~~^~~~~~
|
s228594677 | p03955 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
using namespace std;
void read(int &x){
char ch;bool ok;
for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1;
for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;
}
#define rg register
const int maxn=1e5+10;bool flag;
int n,m,x[maxn*4],y[maxn*4],z[maxn*4],mp[4][maxn];
int f[maxn*4],w[maxn*4],tot,ans,ans1,s[2],ss[2];
#define lowbit(i) (i&(-i))
void add(int x){for(rg int i=x;i<=m;i+=lowbit(i))f[i]++;}
int get(int x){int ans=0;for(rg int i=x;i;i-=lowbit(i))ans+=f[i];return ans;}
int main(){
read(m),n=3;
for(rg int i=1;i<=n;i++)
for(rg int j=1;j<=m;j++)
x[i+3*j-3]=i&1,y[i+3*j-3]=j&1,z[i+3*j-3]=j;
for(rg int i=1;i<=n;i++)for(rg int j=1;j<=m;j++)read(mp[i][j]);
for(rg int i=1;i<=n;i++)
for(rg int j=1;j<=m;j++){
int u=1+z[mp[i][j]]*3-3,v=2+z[mp[i][j]]*3-3,w=3+z[mp[i][j]]*3-3;
bool ok1=0,ok2=0,ok3=0;
if(mp[1][j]==u||mp[2][j]==u||mp[3][j]==u)ok1=1;
if(mp[1][j]==v||mp[2][j]==v||mp[3][j]==v)ok2=1;
if(mp[1][j]==w||mp[2][j]==w||mp[3][j]==w)ok3=1;
if(!(ok1&ok2&ok3))flag=1;
if(((i&1)^x[mp[i][j]])||((j&1)^y[mp[i][j]]))flag=1;
}
if(flag){printf("No\n");return 0;}
for(rg int i=1;i<=m;i+=2)if(mp[1][i]!=1+3*z[mp[1][i]]-3)s[1]^=1;
for(rg int i=2;i<=m;i+=2)if(mp[1][i]!=1+3*z[mp[1][i]]-3)s[0]^=1;
for(rg int i=1;i<=m;i+=2)w[++tot]=z[mp[1][i]];
for(rg int i=1;i<=tot;i++)ans+=i-get(w[i])-1,add(w[i]);
for(rg int i=1;i<=m;i++)f[i]=0;tot=0;
for(rg int i=2;i<=m;i+=2)w[++tot]=z[mp[1][i]];
for(rg int i=1;i<=tot;i++)ans1+=i-get(w[i])-1,add(w[i]);
s[1]^=(ans1&1),s[0]^=(ans&1);
else puts(s[0]!=s[1]?"No":"Yes");
}
| a.cc: In function 'void add(int)':
a.cc:17:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
17 | void add(int x){for(rg int i=x;i<=m;i+=lowbit(i))f[i]++;}
| ^
a.cc: In function 'int get(int)':
a.cc:18:37: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
18 | int get(int x){int ans=0;for(rg int i=x;i;i-=lowbit(i))ans+=f[i];return ans;}
| ^
a.cc: In function 'int main()':
a.cc:21:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
21 | for(rg int i=1;i<=n;i++)
| ^
a.cc:22:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
22 | for(rg int j=1;j<=m;j++)
| ^
a.cc:24:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | for(rg int i=1;i<=n;i++)for(rg int j=1;j<=m;j++)read(mp[i][j]);
| ^
a.cc:24:44: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
24 | for(rg int i=1;i<=n;i++)for(rg int j=1;j<=m;j++)read(mp[i][j]);
| ^
a.cc:25:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
25 | for(rg int i=1;i<=n;i++)
| ^
a.cc:26:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
26 | for(rg int j=1;j<=m;j++){
| ^
a.cc:36:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
36 | for(rg int i=1;i<=m;i+=2)if(mp[1][i]!=1+3*z[mp[1][i]]-3)s[1]^=1;
| ^
a.cc:37:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
37 | for(rg int i=2;i<=m;i+=2)if(mp[1][i]!=1+3*z[mp[1][i]]-3)s[0]^=1;
| ^
a.cc:38:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
38 | for(rg int i=1;i<=m;i+=2)w[++tot]=z[mp[1][i]];
| ^
a.cc:39:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
39 | for(rg int i=1;i<=tot;i++)ans+=i-get(w[i])-1,add(w[i]);
| ^
a.cc:40:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
40 | for(rg int i=1;i<=m;i++)f[i]=0;tot=0;
| ^
a.cc:41:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
41 | for(rg int i=2;i<=m;i+=2)w[++tot]=z[mp[1][i]];
| ^
a.cc:42:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
42 | for(rg int i=1;i<=tot;i++)ans1+=i-get(w[i])-1,add(w[i]);
| ^
a.cc:44:9: error: 'else' without a previous 'if'
44 | else puts(s[0]!=s[1]?"No":"Yes");
| ^~~~
|
s021956815 | p03955 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> stat(n);
vector<int> perm(n);
vector<bool> check(n,0);
for(int i = 0;i<n;i++)
{
int cin__;
cin >> cin__;
stat[i] = cin__%3;
perm[i] = cin__/3;
if(check[perm[i]]==1)
{
cout << "No";
return 0;
}
check[perm[i]]++;
}
for(int i = 0;i<n;i++)
{
int cin__;
cin >> cin__;
if(cin__%3!=2)
{
cout << "No";
return 0;
}
if(cin__/3!=perm[i])
{
cout << "No";
return 0;
}
}
for(int i = 0;i<n;i++)
{
int cin__;
cin >> cin__;
if(cin__%3!=(1-stat[i]))
{
cout << "No";
return 0;
}
if(cin__/3!=perm[i])
{
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
}
| a.cc: In function 'int main()':
a.cc:23:23: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
23 | check[perm[i]]++;
| ~~~~~~~~~~~~~~^~
|
s423449053 | p03955 | C++ | #include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=1e5;
int n;
int a[maxn+8][3],move[2],rev[2];
int read()
{
int x=0,f=1;char ch=getchar();
for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
return x*f;
}
int main()
{
n=read();
for (int i=1;i<=n;i++) a[i][0]=read();
for (int i=1;i<=n;i++) a[i][1]=read();
for (int i=1;i<=n;i++) a[i][2]=read();
bool flag=1;
for (int i=1;i<=n;i++)
{
int cnt=abs(a[i][0]-a[i][1])+abs(a[i][2]-a[i][1]);
if (cnt!=2)
{
flag=0;
break;
}
int x=min(a[i][0],a[i][2]);
if (x%3!=1)
{
flag=0;
break;
}
if (a[i][0]>a[i][1]) rev[i&1]++;
move[i&1]+=max(0,(i-(x+2)/3)/2);
}
//printf("%d %d\n",move[1],rev[1]);
if ((!flag)||((move[0]^rev[1])&1)||((move[1]^rev[0])&1)) puts("No");
else puts("Yes");
return 0;
}
| a.cc: In function 'int main()':
a.cc:41:13: error: reference to 'move' is ambiguous
41 | move[i&1]+=max(0,(i-(x+2)/3)/2);
| ^~~~
In file included from /usr/include/c++/14/algorithm:86,
from a.cc:5:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::move(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
353 | move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
| ^~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
675 | move(_II __first, _II __last, _OI __result)
| ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/bits/move.h:137:5: note: 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
137 | move(_Tp&& __t) noexcept
| ^~~~
a.cc:9:18: note: 'int move [2]'
9 | int a[maxn+8][3],move[2],rev[2];
| ^~~~
a.cc:44:20: error: reference to 'move' is ambiguous
44 | if ((!flag)||((move[0]^rev[1])&1)||((move[1]^rev[0])&1)) puts("No");
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::move(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
353 | move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
| ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
675 | move(_II __first, _II __last, _OI __result)
| ^~~~
/usr/include/c++/14/bits/move.h:137:5: note: 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
137 | move(_Tp&& __t) noexcept
| ^~~~
a.cc:9:18: note: 'int move [2]'
9 | int a[maxn+8][3],move[2],rev[2];
| ^~~~
a.cc:44:42: error: reference to 'move' is ambiguous
44 | if ((!flag)||((move[0]^rev[1])&1)||((move[1]^rev[0])&1)) puts("No");
| ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:353:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::move(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2)'
353 | move(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __d_first);
| ^~~~
/usr/include/c++/14/bits/stl_algobase.h:675:5: note: 'template<class _II, class _OI> _OI std::move(_II, _II, _OI)'
675 | move(_II __first, _II __last, _OI __result)
| ^~~~
/usr/include/c++/14/bits/move.h:137:5: note: 'template<class _Tp> constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&)'
137 | move(_Tp&& __t) noexcept
| ^~~~
a.cc:9:18: note: 'int move [2]'
9 | int a[maxn+8][3],move[2],rev[2];
| ^~~~
|
s269092522 | p03955 | C++ | #include<cstdio>
#include<algorithm>
using namespace std;
int n,t[2],a[5][100010],to[100010];
char buffer[10000010],*hed;
inline char Getchar(){
return *hed++;
}
inline int rd(){
register int x=0;
char c;
do c=Getchar();
while(!isdigit(c));
do{
x=(x<<1)+(x<<3)+(c^48);
c=Getchar();
}while(isdigit(c));
return x;
}
inline int abs(int x){
return x>=0?x:-x;
}
int main(){
int len=fread(buffer,1,10000000,stdin);
hed=buffer;
n=rd();
for(int i=1;i<=3;i++)
for(int j=1;j<=n;j++)
a[i][j]=rd();
for(register int i=1;i<=n;i++){
to[i]=a[2][i]/3+1;
if(!((a[1][i]-a[2][i]==-1&&a[2][i]-a[3][i]==-1&&a[1][i]%3==1)||(a[1][i]-a[2][i]==1&&a[2][i]-a[3][i]==1&&!(a[1][i]%3)))||(abs(i-to[i])&1)){
puts("No");
return 0;
}
t[i&1]^=(a[1][i]>a[2][i]);
}
for(register int i=1;i<=n;i++){
while(to[i]!=i){
t[i&1^1]^=1;
swap(to[i],to[to[i]]);
}
}
puts(t[0]||t[1]?"No":"Yes");
return 0;
} | a.cc: In function 'int rd()':
a.cc:10:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10 | register int x=0;
| ^
a.cc:13:12: error: 'isdigit' was not declared in this scope
13 | while(!isdigit(c));
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:30:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
30 | for(register int i=1;i<=n;i++){
| ^
a.cc:38:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
38 | for(register int i=1;i<=n;i++){
| ^
|
s767506075 | p03955 | C++ | #include<cstdio>
#include<algorithm>
using namespace std;
int n,t[2],a[5][100010],to[100010];
char buffer[10000010],*hed,*tal;
inline char Getchar(){
return *hed++;
}
inline int rd(){
register int x=0;
char c;
do c=Getchar();
while(!isdigit(c));
do{
x=(x<<1)+(x<<3)+(c^48);
c=Getchar();
}while(isdigit(c));
return x;
}
inline int abs(int x){
return x>=0?x:-x;
}
int main(){
int len=fread(buffer,1,10000000,stdin);
hed=buffer,tal=buffer+len;
n=rd();
for(int i=1;i<=3;i++)
for(int j=1;j<=n;j++)
a[i][j]=rd();
for(register int i=1;i<=n;i++){
to[i]=a[2][i]/3+1;
if(!((a[1][i]-a[2][i]==-1&&a[2][i]-a[3][i]==-1&&a[1][i]%3==1)||(a[1][i]-a[2][i]==1&&a[2][i]-a[3][i]==1&&!(a[1][i]%3)))||(abs(i-to[i])&1)){
puts("No");
return 0;
}
t[i&1]^=(a[1][i]>a[2][i]);
}
for(register int i=1;i<=n;i++){
while(to[i]!=i){
t[i&1^1]^=1;
swap(to[i],to[to[i]]);
}
}
puts(t[0]||t[1]?"No":"Yes");
return 0;
} | a.cc: In function 'int rd()':
a.cc:10:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10 | register int x=0;
| ^
a.cc:13:16: error: 'isdigit' was not declared in this scope
13 | while(!isdigit(c));
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:30:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
30 | for(register int i=1;i<=n;i++){
| ^
a.cc:38:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
38 | for(register int i=1;i<=n;i++){
| ^
|
s897326930 | p03955 | C++ | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
int a[3][MAXN];
int f[2][MAXN];
void add(int p, int index) {
for (;p < MAXN; p += p&-p)
++f[index][p];
}
int find(int p, int index) {
int res = 0;
for (;p; p -= p&-p)
res += f[index][p];
return res;
}z
int32_t main () {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < 3; ++i)
for (int j = 0; j < n; ++j)
cin >> a[i][j];
vector <int> vctr;
bool b[2] = {0, 0};
for (int i = 0; i < n; ++i) {
int mx = max(a[0][i], max(a[1][i], a[2][i]));
int mn = min(a[0][i], min(a[1][i], a[2][i]));
if (mx - mn > 2)
return cout << "No", 0;
if (mx % 3)
return cout << "No", 0;
if (2 * a[1][i] != a[0][i] + a[2][i])
return cout << "No", 0;
if ((mx - i) % 2 == 0)
return cout << "No", 0;
vctr.push_back(mx / 3);
if (a[0][i] == mx)
b[i & 1] = 1 - b[i & 1];
// cout << (a[0][i] == mx) << ' ';
}
// cout << b[0] << ' ' << b[1];
for (int i = n - 1; i >= 0; --i) {
if (find(vctr[i], i & 1) & 1)
b[(i + 1) & 1] = 1 - b[(i + 1) & 1];
add(vctr[i], i & 1);
// cout << vctr[i] << ' ';
}
if (b[0] || b[1])
return cout << "No", 0;
cout << "Yes";
return 0;
} | a.cc:15:2: error: 'z' does not name a type
15 | }z
| ^
|
s712833780 | p03955 | C++ | #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
class Segment_Tree{
private:
int n;
vi date;
int Rec(int a,int b,int k,int l,int r){
if(r<=a||b<=l) return 0;
if(a<=l&&r<=b) return date[k];
int m=(l+r)/2;
return Rec(a,b,k*2+1,l,m)+Rec(a,b,k*2+2,m,r);
}
public:
Segment_Tree(int n_){
n=1;
while(n<n_) n*=2;
date=vi(2*n-1);
}
void Update(int k,int x){
k+=n-1;
date[k]+=x;
while(k>0){
k=(k-1)/2;
date[k]=date[k*2+1]+date[k*2+2];
}
}
int Query(int a,int b){
return Rec(a,b,0,0,n);
}
int Open(int k){
return date[k+n-1];
}
};
int n;
vi a[3],b[2];
bool f(vi c,int t){
Segment_Tree st(n);
for(auto i:c){
(t+=st.Query(i,n))%=2;
st.Update(i,1);
}
return t==0;
}
int main(){
cin>>n;
a[0]=a[1]=a[2]=vi(n);
for(int i=0;i<3;i++) for(int j=0;j<n;j++) cin>>a[i][j];
bool B=1;
for(int i=0;i<n;i++) if(abs(a[0][i]-a[1][i])>1||abs(a[1][i]-a[2][i])>1||a[1][j]%3!=2) B=0;
if(!B){
cout<<"No"<<endl;
return 0;
}
int t[2]={0,0};
for(int i=0;i<n;i++){
int A=a[0][i]-1;
if(A%3==2) t[i%2]++;
b[i%2].push_back(A/3);
}
if(f(b[0],t[1])&&f(b[1],t[0])) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:77:86: error: 'j' was not declared in this scope
77 | for(int i=0;i<n;i++) if(abs(a[0][i]-a[1][i])>1||abs(a[1][i]-a[2][i])>1||a[1][j]%3!=2) B=0;
| ^
|
s354890851 | p03955 | C++ |
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <tuple>
#include <complex>
#include <stdio.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
const LD PI = acos(-1.0);
const LL mod = 1000000007;
const LL INF = 1e9;
const LL MAXN = 100001;
void bad()
{
cout << "No";
exit(0);
}
int n;
VVI a;
VPII pos;
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//freopen("In.txt", "r", stdin);
cin >> n;
a.assign(3, VI(n));
FOR(i, 0, 3)
FOR(j, 0, n)
cin >> a[i][j];
pos.assign(3 * n + 1, MP(0, 0));
FOR(i, 0, 3)
FOR(j, 0, n)
pos[a[i][j]] = MP(i, j);
int ser1 = 0, ser2 = 0, bik1 = 0, bik2 = 0;
FOR(i, 0, n)
{
PII one = pos[3 * i + 1];
PII two = pos[3 * i + 2];
PII three = pos[3 * i + 3];
if (one.Y != two.Y || one.Y != three.Y)
bad();
if (two.X != 1)
bad();
int bulo = i, stalo = one.Y;
if (abs(stalo - bulo) & 1)
bad();
if (i & 1)
{
if (abs(bulo - stalo) % 4 == 0){
if(one.X != 0)
++ser1;
}
else{
++bik1;
if(one.X ==0)
++ser1;
}
}
else
{
if(abs(bulo - stalo)%4==0){
if(one.X)
++ser2;
}
else
{
++bik2;
if(!one.X)
++ser2;
}
}
if (abs(ser1 - bik2) & 1)
bad();
if (abs(ser2 - bik1) & 1)
bad();
cout << "Yes";
return 0;
} | a.cc: In function 'int main()':
a.cc:141:2: error: expected '}' at end of input
141 | }
| ^
a.cc:76:1: note: to match this '{'
76 | {
| ^
|
s240649722 | p03955 | C++ | #include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#define rep(i,j,k) for(int i=(j);i<(k);i++)
using namespace std;
int data[3][100005];
int rdata[100005];
int _abs(int a)
{
return a>0?a:-a;
}
int main()
{
int n;
scanf("%d",&n);
rep(j,0,3)rep(i,1,n+1)scanf("%d",&data[j][i]);
rep(i,1,n+1)
{
if(data[1][i]%3!=2)
{
puts("No");
return 0;
}
rdata[i]=(data[1][i]+1)/3;
}
rep(i,1,n+1)if((data[0][i]+2)/3!=rdata[i]||(data[2][i]+2)/3!=rdata[i])
{
puts("No");
return 0;
}
rep(i,1,n+1)if(rdata[i]%2!=i%2)
{
puts("No");
return 0;
}
ll cnt[2]={0,0},nxd[2]={0,0};
rep(i,1,n+1)if(data[0][i]%3==0)cnt[i%2]++;
rep(i,1,n+1)nxd[i%2]+=_abs(i-rdata[i]);
nxd[0]/=4;nxd[1]/=4;
if(cnt[0]%2==nxd[1]%2&&cnt[1]%2==nxd[0]%2)puts("Yes");
else puts("No");
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:39: error: reference to 'data' is ambiguous
19 | rep(j,0,3)rep(i,1,n+1)scanf("%d",&data[j][i]);
| ^~~~
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [3][100005]'
9 | int data[3][100005];
| ^~~~
a.cc:22:12: error: reference to 'data' is ambiguous
22 | if(data[1][i]%3!=2)
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [3][100005]'
9 | int data[3][100005];
| ^~~~
a.cc:27:19: error: reference to 'data' is ambiguous
27 | rdata[i]=(data[1][i]+1)/3;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [3][100005]'
9 | int data[3][100005];
| ^~~~
a.cc:29:21: error: reference to 'data' is ambiguous
29 | rep(i,1,n+1)if((data[0][i]+2)/3!=rdata[i]||(data[2][i]+2)/3!=rdata[i])
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [3][100005]'
9 | int data[3][100005];
| ^~~~
a.cc:29:49: error: reference to 'data' is ambiguous
29 | rep(i,1,n+1)if((data[0][i]+2)/3!=rdata[i]||(data[2][i]+2)/3!=rdata[i])
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [3][100005]'
9 | int data[3][100005];
| ^~~~
a.cc:39:5: error: 'll' was not declared in this scope
39 | ll cnt[2]={0,0},nxd[2]={0,0};
| ^~
a.cc:39:20: error: expected primary-expression before ',' token
39 | ll cnt[2]={0,0},nxd[2]={0,0};
| ^
a.cc:39:21: error: 'nxd' was not declared in this scope
39 | ll cnt[2]={0,0},nxd[2]={0,0};
| ^~~
a.cc:40:20: error: reference to 'data' is ambiguous
40 | rep(i,1,n+1)if(data[0][i]%3==0)cnt[i%2]++;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [3][100005]'
9 | int data[3][100005];
| ^~~~
a.cc:40:36: error: 'cnt' was not declared in this scope; did you mean 'int'?
40 | rep(i,1,n+1)if(data[0][i]%3==0)cnt[i%2]++;
| ^~~
| int
a.cc:43:8: error: 'cnt' was not declared in this scope; did you mean 'int'?
43 | if(cnt[0]%2==nxd[1]%2&&cnt[1]%2==nxd[0]%2)puts("Yes");
| ^~~
| int
|
s851597287 | p03955 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define int long long
struct node{
int k, p, sz;
node * l;
node * r;
node(int k): k(k), p(rand()), l(NULL), r(NULL), sz(0){}
};
int sz(node *t){
if(t == NULL) return 0;
return t->sz;
}
void updsz(node *t){
if(t == NULL) return;
t->sz = sz(t->l)+sz(t->r)+1;
}
void split(node *t, node*& l, node*& r, int k){
if(t == NULL){
l = r = NULL;
} else if(k <= t->k){
split(t->l,l,t->l,k);
r = t;
} else {
split(t->r,t->r,r,k);
l = t;
}
updsz(t);
}
void merge(node *&t, node *l, node *r){
if(l == NULL){
t = r;
} else if(r == NULL){
t = l;
} else if(l->p <= r->p){
merge(l->r,l->r,r);
t = l;
} else {
merge(r->l,l,r->l);
t = r;
}
updsz(t);
}
void ins(node *&t, node *c){
if(t == NULL){
t = c;
} else if(c->p >= t->p){
split(t,c->l,c->r,c->k);
t = c;
} else if(c->k <= t->k){
ins(t->l,c);
} else {
ins(t->r,c);
}
updsz(t);
}
void del(int k, node *&t){
if(t->k == k){
merge(t,t->l,t->r);
} else if(t->k > k){
del(k,t->l);
} else {
del(k,t->r);
}
updsz(t);
}
node* find(node *t, int k){
if(t == NULL) return t;
if(t->k == k) return t;
if(t-> k < k){
return find(t->r,k);
} else {
return find(t->l,k);
}
}
int cnt(node *t, int k){ // <= k
if(t == NULL) return 0;
if(t->k <= k){
return 1 + sz(t->l) + cnt(t->r,k);
} else {
return cnt(t->l,k);
}
}
void pt(node *r){
if(r == NULL) return;
cout << r->k << " " << r->p << " " << r->sz << endl;
pt(r->l);
pt(r->r);
}
node* kth(node *t, int k){ // 0-based indexing
if(k == sz(t->l)){
return t;
} else if(k < sz(t->l)){
return kth(t->l,k);
} else {
return kth(t->r, k-1-sz(t->l));
}
}
LL inv(vector<int> a){
node * treap = NULL;
node * t1, * t2;
LL ans = 0;
for(int i = 0; i < a.size(); i++){
split(treap, t1, t2, a[i]);
ans += sz(t2);
node * cur = new node(a[i]);
merge(t1, t1, cur);
merge(treap, t1, t2);
}
return ans % 2;
}
int main(){
int n;
cin >> n;
int a[3][n];
for(int i = 0; i < 3; i++){
for(int j = 0; j < n; j++){
cin >> a[i][j];
}
}
int ok = 1;
vector<int> b;
int neg[2];
neg[0] = neg[1] = 0;
for(int j = 0; j < n; j++){
if(abs(a[0][j] - a[1][j]) > 1) ok = 0;
if(abs(a[2][j] - a[1][j]) < 1) ok = 0;
int t = a[0][j] < a[1][j];
b.push_back((a[1][j] + 1)/3);
if(!t) neg[j%2]++;
}
for(int j = 0; j < n; j++){
if(b[j] % 2 == j%2) ok = 0;
}
if(!ok){
cout << "No" << endl;
return 0;
}
vector<int> e[2];
for(int i = 0; i < n; i++){
e[i%2].push_back(b[i]);
}
if(inv(e[0]) % 2 != neg[1] % 2) ok = 0;
if(inv(e[1]) % 2 != neg[0] % 2) ok = 0;
if(!ok){
cout << "No" << endl;
} else {
cout << "Yes" << endl;
}
return 0;
}
| cc1plus: error: '::main' must return 'int'
|
s109073105 | p03955 | C++ | #include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int map[3][100000];
bool flag[100000];
int get(vector<int>v)
{
int r = 0;
for (int i = 0; i < v.size(); i++)if (v[i] < 0)r ^= 1, v[i] = -v[i];
for (int i = 0; i < v.size(); i++)v[i] = (v[i] - 1) / 2;
fill(flag, flag + 100000, false);
for (int i = 0; i < v.size(); i++)
{
if (!flag[i])
{
int now = i;
int c = 0;
for (;;)
{
if (flag[now])break;
flag[now] = true;
c++;
now = v[now];
}
if (c % 2 == 0)r ^= 2;
}
}
return r;
}
int main()
{
int num;
scanf("%d", &num);
for (int i = 0; i < 3; i++)for (int j = 0; j < num; j++)scanf("%d", &map[i][j]);
vector<int>vec;
vector<int>v1, v2;
for (int i = 0; i < num; i++)
{
if (map[0][i] + 1 == map[1][i] && map[1][i] + 1 == map[2][i] && map[2][i] % 3 == 0)vec.push_back(map[2][i] / 3);
else if (map[2][i] + 1 == map[1][i] && map[1][i] + 1 == map[0][i] && map[0][i] % 3 == 0)vec.push_back(-map[0][i] / 3);
else goto l01;
}
for (int i = 0; i < num; i++)
{
if (i % 2 == 0)
{
if (vec[i] % 2 == 0)goto l01;
else v1.push_back(vec[i]);
}
else
{
if (vec[i] % 2 == 0)v2.push_back(vec[i]);
else goto l01;
}
}
int s = get(v1), t = get(v2);
if (((s & 1) == 0) == ((t & 2) == 0) && ((s & 2) == 0) == ((t & 1) == 0))printf("Yes\n");
else
{
l01:;
printf("No\n");
}
} | a.cc: In function 'int main()':
a.cc:62:9: error: jump to label 'l01'
62 | l01:;
| ^~~
a.cc:49:50: note: from here
49 | if (vec[i] % 2 == 0)goto l01;
| ^~~
a.cc:58:26: note: crosses initialization of 'int t'
58 | int s = get(v1), t = get(v2);
| ^
a.cc:58:13: note: crosses initialization of 'int s'
58 | int s = get(v1), t = get(v2);
| ^
a.cc:62:9: error: jump to label 'l01'
62 | l01:;
| ^~~
a.cc:43:27: note: from here
43 | else goto l01;
| ^~~
a.cc:58:26: note: crosses initialization of 'int t'
58 | int s = get(v1), t = get(v2);
| ^
a.cc:58:13: note: crosses initialization of 'int s'
58 | int s = get(v1), t = get(v2);
| ^
|
s609068896 | p03955 | C++ | #include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
int map[3][100000];
bool flag[100000];
int get(vector<int>v)
{
int r = 0;
for (int i = 0; i < v.size(); i++)if (v[i] < 0)r ^= 1, v[i] = -v[i];
for (int i = 0; i < v.size(); i++)v[i] = (v[i] - 1) / 2;
fill(flag, flag + 100000, false);
for (int i = 0; i < v.size(); i++)
{
if (!flag[i])
{
int now = i;
int c = 0;
for (;;)
{
if (flag[now])break;
flag[now] = true;
c++;
now = v[now];
}
if (c % 2 == 0)r ^= 2;
}
}
return r;
}
int main()
{
int num;
scanf("%d", &num);
for (int i = 0; i < 3; i++)for (int j = 0; j < num; j++)scanf("%d", &map[i][j]);
vector<int>vec;
vector<int>v1, v2;
for (int i = 0; i < num; i++)
{
if (map[0][i] + 1 == map[1][i] && map[1][i] + 1 == map[2][i] && map[2][i] % 3 == 0)vec.push_back(map[2][i] / 3);
else if (map[2][i] + 1 == map[1][i] && map[1][i] + 1 == map[0][i] && map[0][i] % 3 == 0)vec.push_back(-map[0][i] / 3);
else goto l01;
}
for (int i = 0; i < num; i++)
{
if (i % 2 == 0)
{
if (vec[i] % 2 == 0)goto l01;
else v1.push_back(vec[i]);
}
else
{
if (vec[i] % 2 == 0)v2.push_back(vec[i]);
else goto l01;
}
}
int s = get(v1), t = get(v2);
if (((s & 1) == 0) == ((t & 2) == 0) && ((s & 2) == 0) == ((t & 1) == 0))printf("Yes\n");
else
{
l01:;
printf("No\n");
}
} | a.cc: In function 'int main()':
a.cc:62:9: error: jump to label 'l01'
62 | l01:;
| ^~~
a.cc:49:50: note: from here
49 | if (vec[i] % 2 == 0)goto l01;
| ^~~
a.cc:58:26: note: crosses initialization of 'int t'
58 | int s = get(v1), t = get(v2);
| ^
a.cc:58:13: note: crosses initialization of 'int s'
58 | int s = get(v1), t = get(v2);
| ^
a.cc:62:9: error: jump to label 'l01'
62 | l01:;
| ^~~
a.cc:43:27: note: from here
43 | else goto l01;
| ^~~
a.cc:58:26: note: crosses initialization of 'int t'
58 | int s = get(v1), t = get(v2);
| ^
a.cc:58:13: note: crosses initialization of 'int s'
58 | int s = get(v1), t = get(v2);
| ^
|
s336918289 | p03955 | C++ | #include <stdio.h>
int main()
{
char name[21];
printf("お名前を入力して下さい\t");
gets(name);
printf("\nあなたのお名前は %s です。\n", name);
return 0;
} | a.cc: In function 'int main()':
a.cc:7:7: error: 'gets' was not declared in this scope; did you mean 'getw'?
7 | gets(name);
| ^~~~
| getw
|
s419251821 | p03955 | C++ | #include<stdio.h>
#include <stdlib.h>
int main()
{
char str[100];
char *p = gets(str);
printf("%s\n",str);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:16: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | char *p = gets(str);
| ^~~~
| getw
|
s567257279 | p03955 | C++ | #include <iostream>
#include <string>
#include <sstream>
#include <cassert>
int permutation(int *a, int n) {
bool *b = new bool[n];
for (int i=0;i<n;++i){
b[i] = false;
}
int sign = 1;
for (int i=0;i<n;++i) {
int local_sign = 1;
int j = i;
while (!b[j]) {
b[j] = true;
j = a[j];
if (b[j]) {
break;
}
local_sign *= -1;
}
sign *= local_sign;
}
delete [] b;
return sign;
}
int main() {
int n;
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
iss >> n;
}
int* a1 = new int[n];
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
for (int i=0;i<n;++i) {
int xx;
iss >> xx;
a1[i] = xx;
}
}
int* a2 = new int[n];
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
for (int i=0;i<n;++i) {
int xx;
iss >> xx;
a2[i] = xx;
}
}
int* a3 = new int[n];
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
for (int i=0;i<n;++i) {
int xx;
iss >> xx;
a3[i] = xx;
}
}
int *a = new int [n];
for (int i=0;i<n;++i) {
if (a1[i] < a3[i]) {
if (a3[i] != a1[i]+2 || a2[i] != a1[i]+1) {
std::cout << "No" << std::endl;
return 0;
}
a[i] = a1[i] / 3 + 1;
} else {
if (a1[i] != a3[i]+2 || a2[i] != a3[i]+1) {
std::cout << "No" << std::endl;
return 0;
}
a[i] = - (a3[i] / 3 + 1);
}
}
int *evens = new int[n/2];
int *odds = new int[n/2 + n%2];
int even_sign = 1;
int odd_sign = 1;
for (int i = 0; i < n; ++i) {
if (i%2 == 0) {
if (a[i]%2 == 0) {
std::cout << "No" << std::endl;
return 0;
}
if (a[i] > 0) {
odds[i/2] = a[i]/2;
} else {
odds[i/2] = -a[i]/2;
odd_sign *= -1;
}
} else {
if (a[i]%2 == 1) {
std::cout << "No" << std::endl;
return 0;
}
if (a[i] > 0) {
evens[i/2] = a[i]/2 - 1;
} else {
evens[i/2] = -a[i]/2 - 1;
even_sign *= -1;
}
}
}
if (permutation(odds, n/2 +n%2) * odd_sign * permutation(evens, n/2) * even_sign == 1) {
std::cout << "Yes" << std::endl;
assert(false);
} else {
std::cout << "No" << std::endl;
}
return 0;
} | a.cc:118:1: error: extended character is not valid in an identifier
118 | assert(false);
| ^
a.cc:118:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:118:1: error: '\U00003000\U00003000assert' was not declared in this scope
118 | assert(false);
| ^~~~~~~~~~
|
s321560902 | p03955 | C++ | #include <iostream>
#include <string>
#include <sstream>
int permutation(int *a, int n) {
bool *b = new bool[n];
for (int i=0;i<n;++i){
b[i] = false;
}
int sign = 1;
for (int i=0;i<n;++i) {
int local_sign = 1;
int j = i;
while (!b[j]) {
b[j] = true;
j = a[j];
if (b[j]) {
break;
}
local_sign *= -1;
}
sign *= local_sign;
}
delete [] b;
return sign;
}
int main() {
int n;
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
iss >> n;
}
int* a1 = new int[n];
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
for (int i=0;i<n;++i) {
int xx;
iss >> xx;
a1[i] = xx;
}
}
int* a2 = new int[n];
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
for (int i=0;i<n;++i) {
int xx;
iss >> xx;
a2[i] = xx;
}
}
int* a3 = new int[n];
{
std::string buf;
std::getline(std::cin, buf);
std::istringstream iss(buf);
for (int i=0;i<n;++i) {
int xx;
iss >> xx;
a3[i] = xx;
}
}
int *a = new int [n];
for (int i=0;i<n;++i) {
if (a1[i] < a3[i]) {
if (a3[i] != a1[i]+2 || a2[i] != a1[i]+1) {
std::cout << "No" << std::endl;
return 0;
}
a[i] = a1[i] / 3 + 1;
} else {
if (a1[i] != a3[i]+2 || a2[i] != a3[i]+1) {
std::cout << "No" << std::endl;
return 0;
}
a[i] = - (a3[i] / 3 + 1);
}
}
int *evens = new int[n/2];
int *odds = new int[n/2 + n%2];
int even_sign = 1;
int odd_sign = 1;
for (int i = 0; i < n; ++i) {
if (i%2 == 0) {
if (a[i]%2 == 0) {
std::cout << "No" << std::endl;
return 0;
}
if (a[i] > 0) {
odds[i/2] = a[i]/2;
} else {
odds[i/2] = -a[i]/2;
odd_sign *= -1;
}
} else {
if (a[i]%2 == 1) {
std::cout << "No" << std::endl;
return 0;
}
if (a[i] > 0) {
evens[i/2] = a[i]/2 - 1;
} else {
evens[i/2] = -a[i]/2 - 1;
even_sign *= -1;
}
}
}
if (permutation(odds, n/2 +n%2) * odd_sign * permutation(evens, n/2) * even_sign == 1) {
std::cout << "Yes" << std::endl;
assert(false);
} else {
std::cout << "No" << std::endl;
}
return 0;
} | a.cc:117:1: error: extended character is not valid in an identifier
117 | assert(false);
| ^
a.cc:117:1: error: extended character is not valid in an identifier
a.cc:117:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:117:1: error: '\U00003000\U00003000\U00003000assert' was not declared in this scope
117 | assert(false);
| ^~~~~~~~~~~~
|
s413326649 | p03955 | C++ | #include <iostream>
#include <vector>
#include <list>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
#define dfor(i,a,b) for(int i=(a);i<(b);++i)
#define drfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define drep(i,n) dfor(i,0,n)
#define drrep(i,n) drfor (i,n,0)
#define dump(x) cout << #x << " = " << (x) << endl;
const double EPS = 1e-10;
const double PI = acos(-1.0);
struct UnionFind {
vector<int> data;
UnionFind(int size) : data(size, -1) { }
bool unite(int x, int y) {
x = root(x); y = root(y);
if (x != y) {
if (data[y] < data[x]) swap(x, y);
data[x] += data[y]; data[y] = x;
}
return x != y;
}
bool same(int x, int y) {
return root(x) == root(y);
}
int root(int x) {
return data[x] < 0 ? x : data[x] = root(data[x]);
}
int size(int x) {
return -data[root(x)];
}
};
int main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
vector< pair<int, bool> > v1, v2;
int i,j,cnt=0;
cin >> i;
while (true) {
cin >> j;
v1.push_back(make_pair(j / 6 + 1, (j % 3) == 1));
i--;
if (i == 0) break;
cin >> j;
v2.push_back(make_pair(j / 6 , (j % 3) == 1));
i--;
if (i == 0) break;
}
drep(i, v1.size()) {
if ((((i+1) % 2) == (v1[i].first) % 2)!=v1[i].second) {
cnt++;
}
}
drep(i, v2.size()) {
if ((((i+1) % 2) == (v2[i].first) % 2)!=v2[i].second) {
cnt++;
}
}
if ((cnt%2)==0) {
cout << "Yes";
}
else {
cout << "No";
}
return 0;
}
| a.cc:20:19: error: 'acos' was not declared in this scope
20 | const double PI = acos(-1.0);
| ^~~~
|
s679188379 | p03956 | C++ |
#include<bits/stdc++.h>
using namespace std;
int n,m,head[100100],cnt,col[100100],tot[3],TE;
typedef long long ll;
ll res;
struct node{
int to,next,val;
}edge[200100];
void ae(int u,int v){
edge[cnt].next=head[u],edge[cnt].to=v,edge[cnt].val=1,head[u]=cnt++;
edge[cnt].next=head[v],edge[cnt].to=u,edge[cnt].val=-1,head[v]=cnt++;
}
bool Dye(int x){
tot[col[x]]++;
bool ret=true;
for(int i=head[x];i!=-1;i=edge[i].next){
TE+=(edge[i].val==1);
if(col[edge[i].to]==-1){
col[edge[i].to]=(col[x]+edge[i].val+3)%3;
ret&=Dye(edge[i].to);
}
else ret&=(col[edge[i].to]==(col[x]+edge[i].val+3)%3);
}
return ret;
}
int main(){
scanf("%d%d",&n,&m),memset(head,-1,sizeof(head)),memset(col,-1,sizeof(col));
for(int i=1,x,y;i<=m;i++)scanf("%d%d",&x,&y),ae(x,y);
for(int i=1;i<=n;i++){
if(col[i]!=-1)continue;
memset(tot,0,sizeof(tot)),TE=0;
col[i]=0;
if(!Dye(i)){res+=1ll*(tot[0]+tot[1]+tot[2])*(tot[0]+tot[1]+tot[2]);continue;}
if(!tot[0]||!tot[1]||!tot[2]){res+=TE;continue;}
res+=1ll*tot[0]*tot[1]+1ll*tot[1]*tot[2]+1ll*tot[2]*tot[0];
} | a.cc: In function 'int main()':
a.cc:37:10: error: expected '}' at end of input
37 | }
| ^
a.cc:27:11: note: to match this '{'
27 | int main(){
| ^
|
s412579652 | p03956 | C++ | #include<bits/stdc++.h>
clock_t t=clock();
namespace IO
{
using namespace std;
char buf[1<<22],Out[1<<22],*p1=buf,*p2=buf;
int p3=-1,f=0;
inline void file()
{
#ifdef NTFOrz
freopen("file.in","r",stdin);
#endif
}
inline char getchar()
{
return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
}
inline void flush(){fwrite(Out,1,p3+1,stdout),p3=-1;}
inline void check(){if (p3>(1<<21)) flush();}
inline void putchar(char a){Out[++p3]=a;check();}
inline void putline(string s)
{
int tmp=p3;
while (p3-tmp<s.size()) putchar(s[p3-tmp]);
putchar('\n');
}
inline char gc()
{
char c=getchar();
while (!c||c=='\n'||c==' ') c=getchar();
return c;
}
inline void chktime()
{
#ifdef NTFOrz
printf("%dms\n",clock()-t);
#endif
}
}
namespace my_std
{
using namespace std;
#define getchar IO::getchar
#define putchar IO::putchar
#define Re register
#define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
#define drep(i,a,b) for (Re int i=(a);i>=(b);i--)
#define repv(i,v) for (Re int i=0;i<v.size();i++)
#define go(u) for (Re int i=head[(u)];i;i=e[i].nxt)
#define writesp(x) write(x),putchar(' '),IO::check()
#define writeln(x) write(x),putchar('\n'),IO::check()
#define mem(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define fir first
#define sec second
#define MP make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int INF=0x7fffffff;
inline int read()
{
ll sum=0,f=0;char c=getchar();
while (!isdigit(c)) f|=(c=='-'),c=getchar();
while (isdigit(c)) sum=(sum<<1)+(sum<<3)+(c^48),c=getchar();
return f?-sum:sum;
}
void write(int k)
{
if (k<0) putchar('-'),k=-k;
if (k>=10) write(k/10);
putchar(k%10+48);
}
#define templ template<typename T>
templ inline void chkmax(T &x,T y){if (x<y) x=y;}
templ inline void chkmin(T &x,T y){if (x>y) x=y;}
}
using namespace my_std;
const int N=100010;
int n,m,ecnt,head[N],size,flag,path,cnt[5],col[N];
ll ans;
struct edge{int to,nxt,dis;}e[N<<1];
inline void add_edge(int u,int v,int w){e[++ecnt].to=v,e[ecnt].nxt=head[u],e[ecnt].dis=w,head[u]=ecnt;}
inline int add(int x,int y){return x+y>=3?x+y-3:x+y;}
void dfs(int u)
{
size++,cnt[col[u]]++;
go(u)
{
int v=e[i].to;
path+=(e[i].dis==1);
if (col[v]==INF)
{
col[v]=add(col[u],e[i].dis);
dfs(v);
}
else if (col[v]!=add(col[u],e[i].dis)) flag=1;
}
}
int main()
{
IO::file();
n=read(),m=read();
rep(i,1,n) col[i]=INF;
rep(i,1,m)
{
int u=read(),v=read();
add_edge(u,v,1),add_edge(v,u,2);
}
rep(i,1,n) if (col[i]==INF)
{
size=flag=path=col[i]=0;
memset(cnt,0,sizeof(cnt));
dfs(i);
if (!flag)
{
if (cnt[0]&&cnt[1]&&cnt[2]) ans+=1ll*cnt[0]*cnt[1]+1ll*cnt[1]*cnt[2]+1ll*cnt[2]*cnt[0];
else ans+=path;
}
else ans+=1ll*size*size;
}
writeln(ans);
IO::flush();
IO::chktime();
return 0;
} | a.cc: In function 'void dfs(int)':
a.cc:87:9: error: reference to 'size' is ambiguous
87 | size++,cnt[col[u]]++;
| ^~~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:80:22: note: 'int size'
80 | int n,m,ecnt,head[N],size,flag,path,cnt[5],col[N];
| ^~~~
a.cc:49:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
49 | #define go(u) for (Re int i=head[(u)];i;i=e[i].nxt)
| ^
a.cc:88:9: note: in expansion of macro 'go'
88 | go(u)
| ^~
a.cc: In function 'int main()':
a.cc:104:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
104 | rep(i,1,n) col[i]=INF;
| ^
a.cc:46:36: note: in definition of macro 'rep'
46 | #define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
| ^
a.cc:105:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
105 | rep(i,1,m)
| ^
a.cc:46:36: note: in definition of macro 'rep'
46 | #define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
| ^
a.cc:110:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
110 | rep(i,1,n) if (col[i]==INF)
| ^
a.cc:46:36: note: in definition of macro 'rep'
46 | #define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
| ^
a.cc:112:17: error: reference to 'size' is ambiguous
112 | size=flag=path=col[i]=0;
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:80:22: note: 'int size'
80 | int n,m,ecnt,head[N],size,flag,path,cnt[5],col[N];
| ^~~~
a.cc:120:31: error: reference to 'size' is ambiguous
120 | else ans+=1ll*size*size;
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:80:22: note: 'int size'
80 | int n,m,ecnt,head[N],size,flag,path,cnt[5],col[N];
| ^~~~
a.cc:120:36: error: reference to 'size' is ambiguous
120 | else ans+=1ll*size*size;
| ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:80:22: note: 'int size'
80 | int n,m,ecnt,head[N],size,flag,path,cnt[5],col[N];
| ^~~~
|
s252943571 | p03956 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
//int p = 998244353;
long long p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
if (n == 0) { return 1; }
int x = rui(a, n / 2);
x *= x; x %= p;
if (n % 2 == 1) { x *= a; x %= p; }
return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
inv_kai = kai;
rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
int a = kai[n] * inv_kai[r]; a %= p;
a *= inv_kai[n - r]; a %= p;
return a;
}
vel pa;
int root(int x) {
if (pa[x] == -1) { return x; }
int ans = root(pa[x]); pa[x] = ans;
return ans;
}
void marge(int x, int y) {
x = root(x);
y = root(y);
if (x != y) { pa[x] = y; }
}
#define T vel
T mul(T & a, T & b) {//calcureate a(b(x))
int sz = a.size();
vel c(sz);
rep(i, sz) { c[i] = a[b[i]]; }
return c;
}
T rui1(T & a, int n) {
if (n == 1) { return a; }
T x = rui1(a, n / 2);
x = mul(x, x);
if (n % 2 == 1) { x = mul(x, a); }
return x;
}
void solve(V<V<pin>>& way, vel& con,vel &dist,int now_pot,veb &seen,bool& fl) {
if (!seen[now_pot]) {
seen[now_pot]=true;
con.push_back(now_pot);
for (auto next : way[now_pot]) {
int ne_dist = dist[now_pot] + next.second;
ne_dist %= 3;
int ne_pot = next.first;
if (dist[ne_pot] == -1) {
dist[ne_pot] = ne_dist;
solve(way, con, dist, ne_pot, seen, fl);
}
else {
if (dist[ne_pot] != ne_dist) {
fl = true;
}
}
}
}
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s304399875 | p03956 | C++ | #include <bits/stdc++.h>
using namespace std;
constexpr int max_n = 1e5 + 5;
vector<pair<int, int> > graf[max_n];
long long wynik, zliczanie[5];
int odwiedzony[max_n];
void bfs(int x){
bool crush = false, = false;
zliczanie[1] = 1;
zliczanie[2] = 0;
zliczanie[0] = 0;
odwiedzony[x] = 1;
vector<int> kolejka;
kolejka.push_back(x);
for (unsigned int i = 0; i < kolejka.size(); i++){
if (i > 0 && kolejka[i - 1] == kolejka[i])
cykl = true;
for (pair<int, int> j : graf[kolejka[i]]){
int pom = odwiedzony[kolejka[i]] + j.second;
if (pom <= 0)
pom += 3;
if (!odwiedzony[j.first]){
odwiedzony[j.first] = pom;
zliczanie[pom % 3]++;
kolejka.push_back(j.first);
}
else if (odwiedzony[j.first] % 3 != pom % 3){
crush = true;
}
}
}
if (crush){
wynik += (zliczanie[0] + zliczanie[1] + zliczanie[2]) * (zliczanie[0] + zliczanie[1] + zliczanie[2]);
}
else{
if (!zliczanie[0] || !zliczanie[1] || !zliczanie[2]){
wynik += zliczanie[0] + zliczanie[1] + zliczanie[2] - 1;
if (cykl)
wynik++;
}
else
wynik += zliczanie[0] * zliczanie[1] + zliczanie[1] * zliczanie[2] + zliczanie[2] * zliczanie[0];
cout << zliczanie[0] << " " << zliczanie[1] << " " << zliczanie[2] << "\n";
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m, a, b;
cin >> n >> m;
for (int i = 0; i < m; i++){
cin >> a >> b;
graf[a].emplace_back(b, 1);
graf[b].emplace_back(a, -1);
}
for (int i = 1; i <= n; i++){
if (!odwiedzony[i])
bfs(i);
}
cout << wynik << "\n";
return 0;
} | a.cc: In function 'void bfs(int)':
a.cc:12:26: error: expected unqualified-id before '=' token
12 | bool crush = false, = false;
| ^
a.cc:21:13: error: 'cykl' was not declared in this scope
21 | cykl = true;
| ^~~~
a.cc:42:17: error: 'cykl' was not declared in this scope
42 | if (cykl)
| ^~~~
|
s688111072 | p03956 | C++ | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define MXN 200005
vector<int> v[100005],rv[100005];
int vis[100005];
LL cnt=0;
vector<int> stk;
void dfs(int x){
if(vis[x])return;
vis[x]=1;
cnt++;
stk.pb(x);
for(auto it:v[x]){
dfs(it);
}
for(auto it:rv[x]){
dfs(it);
}
}
void dfs2(int x,int step){
if(vis[x]&(1<<step))return ;
vis[x]|=(1<<step);
for(auto it:v[x]){
dfs2(it,(step+1)%3);
}
for(auto it:rv[x]){
dfs2(it,(step+2)%3);
}
}
int main(){
int n,m;
scanf("%d %d",&n,&m);
pii p[100005];
for(int i = 0;i<m;i++){
int x,y;
scanf("%d %d",&x,&y);
v[x].pb(y);
rv[y].pb(x);
}
LL ans=0;
for(int i = 1;i<=n;i++){
if(!vis[i]){
cnt=0;
stk.clear();
dfs(i);
for(auto it:stk)
vis[it]=0;
dfs2(i,0);
int ok=0;
for(auto it:stk){
if(__builtin_popcount(vis[it])!=1){
ok=1;
ans+=cnt*cnt;
assert(__builtin_popcount(vis[it])!=0)
break;
}
}
if(!ok){
LL tot[3]={0,0,0};
for(auto it:stk){
if(vis[it]==1)tot[0]++;
if(vis[it]==2)tot[1]++;
if(vis[it]==4)tot[2]++;
}
ans+=tot[0]*tot[1]+tot[1]*tot[2]+tot[2]*tot[0];
}
}
}
printf("%lld\n",ans);
}
/*
b[i]*K!/(i)!*(K-i)!
*/ | a.cc: In function 'int main()':
a.cc:74:21: error: expected ';' before 'break'
74 | break;
| ^~~~~
|
s738288763 | p03956 | C++ | //Ilm kave oi, you know ...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 3;
const int infint = (int)1e9 + 3;
const ll inf = (ll)1e12;
int n, m, sz, cyc, visited[MAXN], md0, md1, md2, e;
vector<pair<int, int> > H[MAXN];
void dfs(int u, int num)
{
sz++;
visited[u] = num;
if(num == 0)
md0++;
else
if(num == 1)
md1++;
else
md2++;
for (auto v : H[u])
{
e++;
int nw = num;
if(v.second == 0)
nw = (nw + 1) % 3;
else
nw = (nw + 2) % 3;
if(visited[v.first] == -1)
dfs(v.first, nw);
else
if(visited[v.first] != nw)
cyc = 1;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i = 0; i < m; i++)
{
int u, v;
cin >> u >> v;
H[u].push_back({v, 0});
H[v].push_back({u, 1});
}
memset(visited, -1, sizeof visited);
ll ans = 0;
for (int i = 1; i <= n; i++)
if(visited[i] == -1)
{
sz = 0, cyc = 0, md0 = 0, md1 = 0, md2 = 0, e = 0, dfs(i, 0);
if(cyc == 1)
ans += 1LL * sz * sz;
else
if(mod0 && mod1 && mod2)
ans += 1LL * md0 * md1 + 1LL * md1 * md2 + 1LL * md2 * md0;
else
ans += e / 2;
}
cout << ans;
}
| a.cc: In function 'int main()':
a.cc:60:28: error: 'mod0' was not declared in this scope; did you mean 'modf'?
60 | if(mod0 && mod1 && mod2)
| ^~~~
| modf
a.cc:60:36: error: 'mod1' was not declared in this scope; did you mean 'modf'?
60 | if(mod0 && mod1 && mod2)
| ^~~~
| modf
a.cc:60:44: error: 'mod2' was not declared in this scope; did you mean 'modf'?
60 | if(mod0 && mod1 && mod2)
| ^~~~
| modf
|
s260552066 | p03956 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ref(i,x,y)for(int i=x;i<=y;++i)
const int N=100010;
int n,m,fg,d[N],t[3],S,w;long long ans;vector<pair<int,int> > e[N];
void dfs(int x){
t[d[x]]++;S++;
ref(i,0,((int)e[x].size())-1){
int y=e[x][i].first;w++;
int D=(3+d[x]+e[x][i].second)%3;
if(d[y]==-1)d[y]=D,dfs(y);else if(d[y]!=D)fg=1;
}
}
int main(){
cin>>n>>m;
ref(i,1,m){int x,y;cin>>x>>y;
e[x].push_back(make_pair(y,1));
e[y].push_back(make_pair(x,-1));
}
ref(i,1,n)d[i]=-1;
ref(i,1,n)if(d[i]<0){
fg=d[i]=S=w=T[0]=T[1]=T[2]=0,dfs(i);
if(fg)ans+=1LL*S*S;else
if(!t[0]||!t[1]||!t[2])ans+=w/2;else
ans+=1LL*t[0]*t[1]+1LL*t[1]*t[2]+1LL*t[2]*t[0];
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:22:29: error: 'T' was not declared in this scope
22 | fg=d[i]=S=w=T[0]=T[1]=T[2]=0,dfs(i);
| ^
|
s673663892 | p03956 | C++ | #include <iostream>
#include <cstring>
#include <vector>
using namespace std;
typedef long long i64;
const int MAXN = 1e5 + 10;
i64 answer;
i64 totCnt;
i64 N, M;
i64 check[MAXN];
i64 cnt[3];
bool flag;
vector<pair<i64, i64> > Adj[MAXN];
inline void addEdge(i64 u, i64 v, i64 w)
{
Adj[u].emplace_back(v, w);
}
void DFS(int cur)
{
cnt[check[cur]] ++;
for(auto x : Adj[cur])
{
totCnt += (x.second == 1);
if(check[x.first] != -1)
{
if((check[cur] + x.second) % 3 != check[x.first])
flag = true;
}
else
{
check[x.first] = (check[cur] + x.second) % 3;
DFS(x.first);
}
}
}
int main()
{
ios::sync_with_stdio(false), cin.tie(nullptr);
cin >> N >> M;
for (int i = 1; i <= M; i++)
{
i64 u, v;
cin >> u >> v;
addEdge(u, v, 1);
addEdge(v, u, 2);
}
memset(check, -1, sizeof check);
for(int i = 1; i <= N; i++)
{
if(check[i] != -1)
continue;
check[i] = 0, totCnt = 0;
cnt[0] = cnt[1] = cnt[2] = 0;
flag = false;
DFS(i);
if(flag)
answer += (cnt[0] + cnt[1] + cnt[2]) * (cnt[0] + cnt[1] + cnt[2]);
else if(!cnt[0] || !cnt[1] || !cnt[2])
answer += totCnt;
else
answer += cnt[0] * cnt[1] + cnt[1] * cnt[2] + cnt[2] * cnt[0];
}
cout << answer << endl ;
return 0;
}
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
typedef long long i64;
const int MAXN = 1e5 + 10;
i64 answer;
i64 totCnt;
i64 N, M;
i64 check[MAXN];
i64 cnt[3];
bool flag;
vector<pair<i64, i64> > Adj[MAXN];
inline void addEdge(i64 u, i64 v, i64 w)
{
Adj[u].emplace_back(v, w);
}
void DFS(int cur)
{
cnt[check[cur]] ++;
for(auto x : Adj[cur])
{
totCnt += (x.second == 1);
if(check[x.first] != -1)
{
if((check[cur] + x.second) % 3 != check[x.first])
flag = true;
}
else
{
check[x.first] = (check[cur] + x.second) % 3;
DFS(x.first);
}
}
}
int main()
{
ios::sync_with_stdio(false), cin.tie(nullptr);
cin >> N >> M;
for (int i = 1; i <= M; i++)
{
i64 u, v;
cin >> u >> v;
addEdge(u, v, 1);
addEdge(v, u, 2);
}
memset(check, -1, sizeof check);
for(int i = 1; i <= N; i++)
{
if(check[i] != -1)
continue;
check[i] = 0, totCnt = 0;
cnt[0] = cnt[1] = cnt[2] = 0;
flag = false;
DFS(i);
if(flag)
answer += (cnt[0] + cnt[1] + cnt[2]) * (cnt[0] + cnt[1] + cnt[2]);
else if(!cnt[0] || !cnt[1] || !cnt[2])
answer += totCnt;
else
answer += cnt[0] * cnt[1] + cnt[1] * cnt[2] + cnt[2] * cnt[0];
}
cout << answer << endl ;
return 0;
}
Submission | a.cc:87:11: error: redefinition of 'const int MAXN'
87 | const int MAXN = 1e5 + 10;
| ^~~~
a.cc:6:11: note: 'const int MAXN' previously defined here
6 | const int MAXN = 1e5 + 10;
| ^~~~
a.cc:89:5: error: redefinition of 'i64 answer'
89 | i64 answer;
| ^~~~~~
a.cc:8:5: note: 'i64 answer' previously declared here
8 | i64 answer;
| ^~~~~~
a.cc:90:5: error: redefinition of 'i64 totCnt'
90 | i64 totCnt;
| ^~~~~~
a.cc:9:5: note: 'i64 totCnt' previously declared here
9 | i64 totCnt;
| ^~~~~~
a.cc:91:5: error: redefinition of 'i64 N'
91 | i64 N, M;
| ^
a.cc:10:5: note: 'i64 N' previously declared here
10 | i64 N, M;
| ^
a.cc:91:8: error: redefinition of 'i64 M'
91 | i64 N, M;
| ^
a.cc:10:8: note: 'i64 M' previously declared here
10 | i64 N, M;
| ^
a.cc:92:5: error: redefinition of 'i64 check [100010]'
92 | i64 check[MAXN];
| ^~~~~
a.cc:11:5: note: 'i64 check [100010]' previously declared here
11 | i64 check[MAXN];
| ^~~~~
a.cc:93:5: error: redefinition of 'i64 cnt [3]'
93 | i64 cnt[3];
| ^~~
a.cc:12:5: note: 'i64 cnt [3]' previously declared here
12 | i64 cnt[3];
| ^~~
a.cc:95:6: error: redefinition of 'bool flag'
95 | bool flag;
| ^~~~
a.cc:14:6: note: 'bool flag' previously declared here
14 | bool flag;
| ^~~~
a.cc:97:25: error: redefinition of 'std::vector<std::pair<long long int, long long int> > Adj [100010]'
97 | vector<pair<i64, i64> > Adj[MAXN];
| ^~~
a.cc:16:25: note: 'std::vector<std::pair<long long int, long long int> > Adj [100010]' previously declared here
16 | vector<pair<i64, i64> > Adj[MAXN];
| ^~~
a.cc:99:13: error: redefinition of 'void addEdge(i64, i64, i64)'
99 | inline void addEdge(i64 u, i64 v, i64 w)
| ^~~~~~~
a.cc:18:13: note: 'void addEdge(i64, i64, i64)' previously defined here
18 | inline void addEdge(i64 u, i64 v, i64 w)
| ^~~~~~~
a.cc:104:6: error: redefinition of 'void DFS(int)'
104 | void DFS(int cur)
| ^~~
a.cc:23:6: note: 'void DFS(int)' previously defined here
23 | void DFS(int cur)
| ^~~
a.cc:125:5: error: redefinition of 'int main()'
125 | int main()
| ^~~~
a.cc:44:5: note: 'int main()' previously defined here
44 | int main()
| ^~~~
a.cc:163:1: error: 'Submission' does not name a type
163 | Submission
| ^~~~~~~~~~
|
s557683822 | p03956 | C++ | #include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int n,m,k,t,cnt[3],c[maxn];
bool vis[maxn],flag,edge;
vector<pair<int,int>>e[maxn];
void dfs(int x)
{
cnt[c[x]]++;
for(int i=0;i<e[x].size();i++)
{
int to=e[x][i].first,w=e[x][i].second;
if(w==1)edge++;
if(!vis[to])
{
vis[to]=true;
c[to]=(c[x]+w)%3;
dfs(to);
}
else if(c[to]!=(c[x]+w)%3)flag=false;
}
}
int main()
{
int i,j;
scanf("%d%d",&n,&m);
while(m--)
{
int x,y;
scanf("%d%d",&x,&y);
e[x].push_back({y,1}),e[y].push_back({x,2});
}
long long ret=0;
for(i=1;i<=n;i++)
{
if(!vis[i])
{
vis[i]=true;
c[i]=0;
cnt[0]=cnt[1]=cnt[2]=0;
flag=true;
edge=0;
dfs(i,0);
if(!flag)
{
ret+=1LL*(cnt[0]+cnt[1]+cnt[2])*(cnt[0]+cnt[1]+cnt[2]);
}
else if(!cnt[2]||!cnt[1]||!cnt[0])
{
ret+=edge;
}
else ret+=1LL*cnt[0]*cnt[1]+1LL*cnt[1]*cnt[2]+1LL*cnt[2]*cnt[0];
}
}
printf("%lld\n",ret);
return 0;
}
| a.cc: In function 'void dfs(int)':
a.cc:13:17: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
13 | if(w==1)edge++;
| ^~~~
a.cc: In function 'int main()':
a.cc:43:16: error: too many arguments to function 'void dfs(int)'
43 | dfs(i,0);
| ~~~^~~~~
a.cc:7:6: note: declared here
7 | void dfs(int x)
| ^~~
|
s747708971 | p03956 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAXN 100000
#define ll long long
#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
vector<int> e[MAXN+5], f[MAXN+5]; bool sl; int color[MAXN+5], n, m; ll Ans, c[3], s;
void DFS(int p, int x){if(~color[p]){sl |= color[p]^x; return;} color[p] = x, ++c[x], ++s, m += e[p].size(); for(auto v:e[p]) DFS(v,-~x%3); for(auto v:f[p]) DFS(v,-~-~x%3);}
int main()
{
n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
for(rint i = 1; i <= n; color[i]<0 ? DFS(i,s=c[0]=c[1]=c[2]=m=sl=0), Ans = sl?Ans+s*s:c[0]&&c[1]&&c[2]?Ans+c[0]*c[1]+c[1]*c[2]+c[2]*c[0]:Ans+m : 0, i++); printf("%lld\n",Ans); return 0;
} | a.cc:13:1: error: 'vector' does not name a type
13 | vector<int> e[MAXN+5], f[MAXN+5]; bool sl; int color[MAXN+5], n, m; ll Ans, c[3], s;
| ^~~~~~
a.cc: In function 'void DFS(int, int)':
a.cc:14:97: error: 'e' was not declared in this scope
14 | void DFS(int p, int x){if(~color[p]){sl |= color[p]^x; return;} color[p] = x, ++c[x], ++s, m += e[p].size(); for(auto v:e[p]) DFS(v,-~x%3); for(auto v:f[p]) DFS(v,-~-~x%3);}
| ^
a.cc:14:152: error: 'f' was not declared in this scope
14 | void DFS(int p, int x){if(~color[p]){sl |= color[p]^x; return;} color[p] = x, ++c[x], ++s, m += e[p].size(); for(auto v:e[p]) DFS(v,-~x%3); for(auto v:f[p]) DFS(v,-~-~x%3);}
| ^
a.cc: In function 'int main()':
a.cc:17:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:17:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:17:82: error: 'e' was not declared in this scope
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:17:101: error: 'f' was not declared in this scope
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:18:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
18 | for(rint i = 1; i <= n; color[i]<0 ? DFS(i,s=c[0]=c[1]=c[2]=m=sl=0), Ans = sl?Ans+s*s:c[0]&&c[1]&&c[2]?Ans+c[0]*c[1]+c[1]*c[2]+c[2]*c[0]:Ans+m : 0, i++); printf("%lld\n",Ans); return 0;
| ^
|
s827746877 | p03956 | C++ | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAXN 100000
#define MOD 1000000007
#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
vector<int> e[MAXN+5], f[MAXN+5]; bool sl; int color[MAXN+5], c[3], s, n, m, Ans;
void DFS(int p, int x){if(~color[p]){sl |= color[p]^x; return;} color[p] = x, ++c[x], ++s, m += e[p].size(); for(auto v:e[p]) DFS(v,-~x%3); for(auto v:f[p]) DFS(v,-~-~x%3);}
int main()
{
n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
for(rint i = 1; i <= n; color[i]<0 ? DFS(i,s=c[0]=c[1]=c[2]=m=sl=0), Ans = (sl?Ans+1ll*s*s:c[0]&&c[1]&&c[2]?Ans+1ll*c[0]*c[1]+1ll*c[1]*c[2]+1ll*c[2]*c[0]:Ans+m)%MOD : 0, i++); printf("%d\n",Ans); return 0;
} | a.cc:13:1: error: 'vector' does not name a type
13 | vector<int> e[MAXN+5], f[MAXN+5]; bool sl; int color[MAXN+5], c[3], s, n, m, Ans;
| ^~~~~~
a.cc: In function 'void DFS(int, int)':
a.cc:14:97: error: 'e' was not declared in this scope
14 | void DFS(int p, int x){if(~color[p]){sl |= color[p]^x; return;} color[p] = x, ++c[x], ++s, m += e[p].size(); for(auto v:e[p]) DFS(v,-~x%3); for(auto v:f[p]) DFS(v,-~-~x%3);}
| ^
a.cc:14:152: error: 'f' was not declared in this scope
14 | void DFS(int p, int x){if(~color[p]){sl |= color[p]^x; return;} color[p] = x, ++c[x], ++s, m += e[p].size(); for(auto v:e[p]) DFS(v,-~x%3); for(auto v:f[p]) DFS(v,-~-~x%3);}
| ^
a.cc: In function 'int main()':
a.cc:17:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:17:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:17:82: error: 'e' was not declared in this scope
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:17:101: error: 'f' was not declared in this scope
17 | n = read(); for(rint a, b = c[0] = read(); c[0]; a = read(), b = read(), e[a].push_back(b), f[b].push_back(a), c[0]--); memset(color+1,-1,n<<2);
| ^
a.cc:18:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
18 | for(rint i = 1; i <= n; color[i]<0 ? DFS(i,s=c[0]=c[1]=c[2]=m=sl=0), Ans = (sl?Ans+1ll*s*s:c[0]&&c[1]&&c[2]?Ans+1ll*c[0]*c[1]+1ll*c[1]*c[2]+1ll*c[2]*c[0]:Ans+m)%MOD : 0, i++); printf("%d\n",Ans); return 0;
| ^
|
s667587380 | p03956 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
using namespace std;
map<pii, bool> hash;
const int Maxn = 100010;
int n, m, fa[Maxn], fg[Maxn], siz[Maxn], work[Maxn], color[Maxn], cnt[3], vis[Maxn];
vector<int> edge[Maxn], back[Maxn];
int find(int x) {
return x == fa[x] ? x : fa[x] = find(fa[x]);
}
void unit(int x, int y) {
x = find(x), y = find(y);
if(x == y) return;
siz[y] += siz[x];
fg[y] |= fg[x]; fa[x] = y;
}
void dfs(int u, int co) {
vis[u] = 1; color[u] = co; cnt[co]++;
for(int it = 0; it < edge[u].size(); ++it) {
if(!vis[edge[u][it]]) {
dfs(edge[u][it], (co+1)%3);
}
}
for(int it = 0; it < back[u].size(); ++it) {
if(!vis[back[u][it]]) {
dfs(back[u][it], (co+2)%3);
}
}
}
long long ans;
int main() {
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; ++i)
fa[i] = i, siz[i] = 1;
for(int i = 1; i <= m; ++i) {
int u, v;
scanf("%d%d", &u, &v);
edge[u].pb(v);
back[v].pb(u);
hash[mp(u, v)] = 1;
unit(u, v);
if(hash[mp(v, u)]) fg[find(u)] = 1;
}
for(int i = 1; i <= n; ++i)
if(find(i) == i) {
if(fg[i]) {
work[i] = 1;
ans += 1ll*siz[i]*siz[i];
} else {
memset(cnt, 0, sizeof cnt);
dfs(i, 0);
if(cnt[0] && cnt[1] && cnt[2]) {
work[i] = 1;
ans += 1ll*cnt[0]*cnt[1]+1ll*cnt[1]*cnt[2]+1ll*cnt[0]*cnt[2];
}
}
}
for(int i = 1; i <= n; ++i)
if(!work[find(i)]) {
for(int it = 0; it < edge[i].size(); ++it)
if(!work[find(edge[i][it])])
ans++;
}
printf("%lld\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:58:17: error: reference to 'hash' is ambiguous
58 | hash[mp(u, v)] = 1;
| ^~~~
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:5:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
59 | struct hash;
| ^~~~
a.cc:14:16: note: 'std::map<std::pair<int, int>, bool> hash'
14 | map<pii, bool> hash;
| ^~~~
a.cc:60:20: error: reference to 'hash' is ambiguous
60 | if(hash[mp(v, u)]) fg[find(u)] = 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:14:16: note: 'std::map<std::pair<int, int>, bool> hash'
14 | map<pii, bool> hash;
| ^~~~
|
s676246451 | p03956 | C++ | #include<bits/stdc++.h>
using namespace std;
#define N 1111116
int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
long long cnt,cmt,c[3],ans;
void travel(int x,int k){
if (!h[x][0]&&!h[x][1]&&!h[x][2]) cnt++;
h[x][k]=1;c[k]++;
for (int t=p[x];t;t=next[t])
if (!h[y[t]][(k+z[t])%3]){
if (!w[t]) cmt++;
travel(y[t],(k+z[t])%2);
}
}
int read(){
int x=0,f=1;char ch=getchar();
for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-f;
for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
return x*f;
}
int main(){
n=read();m=read();
for (int i=1;i<=m;i++){
x[2*i-1]=y[2*i]=read();
y[2*i-1]=x[2*i]=read();
z[2*i-1]=1;z[2*i]=2;
next[2*i-1]=p[x[2*i-1]];p[x[2*i-1]]=2*i-1;
next[2*i]=p[x[2*i]];p[x[2*i]]=2*i;
}
for (int i=1;i<=n;i++)
if (!h[i][0]&&!h[i][1]&&!h[i][2]){
cnt=0;cmt=0;c[0]=c[1]=c[2]=0;travel(i,0);
if (h[i][1]) ans+=cnt*cnt;
else if (c[1]&&c[2]) ans+=c[0]*c[1]+c[1]*c[2]+c[2]*c[0];
else ans+=cmt;
}
printf("%lld\n",ans);
return 0;
} | a.cc: In function 'void travel(int, int)':
a.cc:11:29: error: reference to 'next' is ambiguous
11 | for (int t=p[x];t;t=next[t])
| ^~~~
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:5:29: note: 'int next [1111116]'
5 | int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
| ^~~~
a.cc: In function 'int main()':
a.cc:31:17: error: reference to 'next' is ambiguous
31 | next[2*i-1]=p[x[2*i-1]];p[x[2*i-1]]=2*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:5:29: note: 'int next [1111116]'
5 | int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
| ^~~~
a.cc:32:17: error: reference to 'next' is ambiguous
32 | next[2*i]=p[x[2*i]];p[x[2*i]]=2*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:5:29: note: 'int next [1111116]'
5 | int n,m,x[N],y[N],z[N],w[N],next[N],p[N],h[N][3];
| ^~~~
|
s142159759 | p03956 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
using namespace std;
typedef long long LL;
const int N=2e5+100;
int gi() {
int w=0;bool q=1;char c=getchar();
while ((c<'0'||c>'9') && c!='-') c=getchar();
if (c=='-') q=0,c=getchar();
while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
return q? w:-w;
}
int head[N],next[N],to[N],w[N];
int c[3],col[N],e;
bool vis[N],flag;
inline void dfs(int k,int d) {
c[col[k]=d]++;vis[k]=true;
for (int i=head[k];i;i=next[i],e++)
if (!vis[to[i]]) dfs(to[i],(d+w[i])%3);
else if ((d+w[i])%3!=col[to[i]]) flag=false;
}
int main()
{
int n=gi(),m=gi(),i,a,b,tot=0;LL ans=0;
for (i=1;i<=m;i++) {
a=gi(),b=gi();
to[++tot]=b,next[tot]=head[a],head[a]=tot,w[tot]=1;
to[++tot]=a,next[tot]=head[b],head[b]=tot,w[tot]=2;
}
for (i=1;i<=n;i++)
if (!vis[i]) {
c[0]=c[1]=c[2]=e=0;
flag=true;
dfs(i,0);
if (flag)
if (c[0]&&c[1]&&c[2])
ans+=1LL*c[0]*c[1]+1LL*c[0]*c[2]+1LL*c[1]*c[2];
else ans+=e>>1;
else ans+=1LL*(c[0]+c[1]+c[2])*(c[0]+c[1]+c[2]);
}
printf("%lld\n",ans);
return 0;
}
| a.cc: In function 'void dfs(int, int)':
a.cc:26:32: error: reference to 'next' is ambiguous
26 | for (int i=head[k];i;i=next[i],e++)
| ^~~~
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:21:13: note: 'int next [200100]'
21 | int head[N],next[N],to[N],w[N];
| ^~~~
a.cc: In function 'int main()':
a.cc:35:29: error: reference to 'next' is ambiguous
35 | to[++tot]=b,next[tot]=head[a],head[a]=tot,w[tot]=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:21:13: note: 'int next [200100]'
21 | int head[N],next[N],to[N],w[N];
| ^~~~
a.cc:36:29: error: reference to 'next' is ambiguous
36 | to[++tot]=a,next[tot]=head[b],head[b]=tot,w[tot]=2;
| ^~~~
/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:21:13: note: 'int next [200100]'
21 | int head[N],next[N],to[N],w[N];
| ^~~~
|
s749984266 | p03956 | C++ | #include <iostream>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <stdio.h>
using namespace std;
int main(int argc, char* argv[])
{
char s[100];
gets(s);
cout<<s<<endl;
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
10 | gets(s);
| ^~~~
| getw
|
s125897272 | p03956 | C++ | 1.#include <cstdio>
2.#include <cstring>
3.#include <cmath>
4.#include <algorithm>
5.#include <vector>
6.#include <string>
7.#include <map>
8.#include <set>
9.#include <cassert>
10.using namespace std;
11.#define rep(i,a,n) for (int i=a;i<n;i++)
12.#define per(i,a,n) for (int i=n-1;i>=a;i--)
13.#define pb push_back
14.#define mp make_pair
15.#define all(x) (x).begin(),(x).end()
16.#define fi first
17.#define se second
18.#define SZ(x) ((int)(x).size())
19.typedef vector<int> VI;
20.typedef long long ll;
21.typedef pair<int,int> PII;
22.const ll mod=1000000007;
23.ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
24.// head
25.
26.const int N=201000;
27.int p[N],q[N],n;
28.bool check(int x) {
29. rep(i,1,2*n) if (p[i]>=x) q[i]=1; else q[i]=0;
30. int pr=1;
31.// rep(i,1,2*n) printf("%d",q[i]);
32.// puts("");
33. rep(i,2,2*n+1) {
34. if (q[i]==q[i-1]||i==2*n) {
35. if (pr==i-1) pr=i;
36. else {
37. if (q[pr]==q[i-1]) {
38. rep(j,pr,i) q[j]=q[pr];
39. } else {
40. int md=(pr+i)/2;
41. rep(j,pr,md) q[j]=q[pr];
42. rep(j,md,i) q[j]=q[i-1];
43. }
44. pr=i;
45. }
46. }
47. }
48.// rep(i,1,2*n) printf("%d",q[i]);
49.// puts("");
50. return q[n];
51.}
52.int main() {
53. scanf("%d",&n);
54. rep(i,1,2*n) scanf("%d",p+i);
55. int l=0,r=2*n-1;
56. while (l+1<r) {
57. int md=(l+r)>>1;
58. if (check(md)==0) r=md; else l=md;
59. }
60. printf("%d\n",l);
61.}
| a.cc:1:3: error: stray '#' in program
1 | 1.#include <cstdio>
| ^
a.cc:2:3: error: stray '#' in program
2 | 2.#include <cstring>
| ^
a.cc:3:3: error: stray '#' in program
3 | 3.#include <cmath>
| ^
a.cc:4:3: error: stray '#' in program
4 | 4.#include <algorithm>
| ^
a.cc:5:3: error: stray '#' in program
5 | 5.#include <vector>
| ^
a.cc:6:3: error: stray '#' in program
6 | 6.#include <string>
| ^
a.cc:7:3: error: stray '#' in program
7 | 7.#include <map>
| ^
a.cc:8:3: error: stray '#' in program
8 | 8.#include <set>
| ^
a.cc:9:3: error: stray '#' in program
9 | 9.#include <cassert>
| ^
a.cc:11:4: error: stray '#' in program
11 | 11.#define rep(i,a,n) for (int i=a;i<n;i++)
| ^
a.cc:12:4: error: stray '#' in program
12 | 12.#define per(i,a,n) for (int i=n-1;i>=a;i--)
| ^
a.cc:13:4: error: stray '#' in program
13 | 13.#define pb push_back
| ^
a.cc:14:4: error: stray '#' in program
14 | 14.#define mp make_pair
| ^
a.cc:15:4: error: stray '#' in program
15 | 15.#define all(x) (x).begin(),(x).end()
| ^
a.cc:16:4: error: stray '#' in program
16 | 16.#define fi first
| ^
a.cc:17:4: error: stray '#' in program
17 | 17.#define se second
| ^
a.cc:18:4: error: stray '#' in program
18 | 18.#define SZ(x) ((int)(x).size())
| ^
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1.#include <cstdio>
| ^~
a.cc:11:1: error: expected unqualified-id before numeric constant
11 | 11.#define rep(i,a,n) for (int i=a;i<n;i++)
| ^~~
a.cc:11:36: error: 'i' does not name a type
11 | 11.#define rep(i,a,n) for (int i=a;i<n;i++)
| ^
a.cc:11:40: error: 'i' does not name a type
11 | 11.#define rep(i,a,n) for (int i=a;i<n;i++)
| ^
a.cc:12:38: error: 'i' does not name a type
12 | 12.#define per(i,a,n) for (int i=n-1;i>=a;i--)
| ^
a.cc:12:43: error: 'i' does not name a type
12 | 12.#define per(i,a,n) for (int i=n-1;i>=a;i--)
| ^
a.cc:20:1: error: expected unqualified-id before numeric constant
20 | 20.typedef long long ll;
| ^~~~~~~~~~
a.cc:21:1: error: expected unqualified-id before numeric constant
21 | 21.typedef pair<int,int> PII;
| ^~~~~~~~~~
a.cc:22:1: error: expected unqualified-id before numeric constant
22 | 22.const ll mod=1000000007;
| ^~~~~~~~
a.cc:23:1: error: expected unqualified-id before numeric constant
23 | 23.ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
| ^~~~~
a.cc:24:1: error: expected unqualified-id before numeric constant
24 | 24.// head
| ^~~
a.cc:27:1: error: expected unqualified-id before numeric constant
27 | 27.int p[N],q[N],n;
| ^~~~~~
a.cc:28:1: error: expected unqualified-id before numeric constant
28 | 28.bool check(int x) {
| ^~~~~~~
a.cc:52:1: error: expected unqualified-id before numeric constant
52 | 52.int main() {
| ^~~~~~
|
s349379645 | p03956 | C++ | #include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int N,M;
cin>>N>>M;
int i,j;
char **X=new char*[N];
for (i=0;i<N;i++){
X[i]=new char[N+1];
memset(X[i],'w',N);
X[i][N]='\0';
}
int a,b;
for (j=0;j<M;j++){
cin>>a>>b;
X[a-1][b-1]='b';
}
int x,y,z;
for (x=0;x<N;x++){
for (y=0;y<N;y++){
for (z=0;z<N;z++){
if (X[x][y]=='b' && X[y][z]=='b' && X[z][x]=='w'){
X[z][x]='b';
}
}
}
}
int aw=0;
for (i=0;i<N;i++){
for (j=0;j<N;j++){
if (X[i][j]=='b'){
aw++;
}
}
}
cout<<aw<<endl;
for (i=0;i<N;i++){
delete[] X[i];
}
delete[] X;
return 0;
} | a.cc: In function 'int main(int, char**)':
a.cc:12:17: error: 'memset' was not declared in this scope
12 | memset(X[i],'w',N);
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s096235431 | p03956 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------
int L[101010];
vector<pair<int,int>> E[101010];
int N,M;
ll NL[3],NG,NE;
void dfs(int cur,int pre) {
NL[L[cur]]++;
FORR(r,E[cur]) if(r.first!=pre) {
NE++;
if(L[r.first]==-1) {
L[r.first]=(L[cur]+r.second)%3;
dfs(r.first,cur);
}
else {
if(L[r.first]!=(L[cur]+r.second)%3) NG++;
}
}
}
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N>>M;
FOR(i,M) {
cin>>x>>y;
E[x-1].push_back({y-1,1});
E[y-1].push_back({x-1,2});
}
MINUS(L);
ll ret=0;
FOR(i,N) if(L[i]==-1) {
NL[0]=NL[1]=NL[2]=0;
NG=NE=0;
L[i]=0;
dfs(i,-1);
if(NG) ret += (NL[0]+NL[1]+NL[2])*(NL[0]+NL[1]+NL[2]);
else if(NL[1]==0 || NL[2]==0) ret += NE;
return ret += NL[0]*NL[1]+NL[1]*NL[2]+NL[2]*NL[0];
}
cout<<ret<<endl;
}
int main(int argc,char** argv){
string s;int i;
if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
FOR(i,argc-1) s+=argv[i+1],s+='\n';
FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
solve(); return 0;
}
| a.cc: In function 'void solve()':
a.cc:54:28: error: return-statement with a value, in function returning 'void' [-fpermissive]
54 | return ret += NL[0]*NL[1]+NL[1]*NL[2]+NL[2]*NL[0];
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s407678309 | p03956 | C++ | #include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<utility>
#include<functional>
#include<iomanip>
#include<sstream>
#include<ctime>
#include<cassert>
using namespace std;
#define y0 y0z
#define y1 y1z
#define yn ynz
#define j0 j0z
#define j1 j1z
#define jn jnz
#define tm tmz
#define buli(x) (__builtin_popcountll(x))
#define bur0(x) (__builtin_ctzll(x))
#define bul2(x) (63-__builtin_clzll(x))
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fil(a,b) memset((a),(b),sizeof(a))
#define cl(a) fil(a,0)
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define foreach(it,a) for(__typeof((a).begin()) it=(a).begin();it!=(a).end();it++)
#define rep(i,a,b) for (int i=(a),_ed=(b);i<_ed;i++)
#define per(i,a,b) for (int i=(b)-1,_ed=(a);i>=_ed;i--)
#define forg(i,gu) for (int i=gu;~i;i=e[i].next)
#define pw(x) ((ll(1))<<(x))
#define upmo(a,b) (((a)=((a)+(b))%mo)<0?(a)+=mo:(a))
#define mmo(a,b) (((a)=1ll*(a)*(b)%mo)<0?(a)+=mo:(a))
void getre(){int x=0;printf("%d\n",1/x);}
void gettle(){int res=1;while(1)res<<=1;printf("%d\n",res);}
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
template<typename T,typename S>inline bool upmin(T&a,const S&b){return a>b?a=b,1:0;}
template<typename T,typename S>inline bool upmax(T&a,const S&b){return a<b?a=b,1:0;}
template<typename N,typename PN>inline N flo(N a,PN b){return a>=0?a/b:-((-a-1)/b)-1;}
template<typename N,typename PN>inline N cei(N a,PN b){return a>0?(a-1)/b+1:-(-a/b);}
template<typename N>N gcd(N a,N b){return b?gcd(b,a%b):a;}
template<typename N>inline int sgn(N a){return a>0?1:(a<0?-1:0);}
#if ( ( _WIN32 || __WIN32__ ) && __cplusplus < 201103L)
#define lld "%I64d"
#else
#define lld "%lld"
#endif
inline void gn(long long&x){
int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
inline void gn(double&x){double t;scanf("%lf",&t);x=t;}
inline void gn(long double&x){double t;scanf("%lf",&t);x=t;}
inline void gs(char *s){scanf("%s",s);}
inline void gc(char &c){while((c=getchar())>126 || c<33);}
inline void pc(char c){putchar(c);}
#ifdef JCVB
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif
typedef long long ll;
typedef double db;
inline ll sqr(ll a){return a*a;}
inline db sqrf(db a){return a*a;}
const int inf=0x3f3f3f3f;
const db pi=3.14159265358979323846264338327950288L;
const db eps=1e-6;
//const int mo=0;
//int qp(int a,ll b){int n=1;do{if(b&1)n=1ll*n*a%mo;a=1ll*a*a%mo;}while(b>>=1);return n;}
int n;
int fa[433333];
int sz[433333];
int gf(int x){
return x==fa[x]?x:fa[x]=gf(fa[x]);
}
void un(int x,int y){
x=gf(x);y=gf(y);
if(x==y)return;
sz[y]+=sz[x];
fa[x]=y;
}
int m;
int main()
{
#ifdef JCVB
//freopen("1.in","r",stdin);
//freopen("1.out","w",stdout);
int _time_jc=clock();
#endif
gn(n);
gn(m);
rep(i,1,n*4+1)fa[i]=i,sz[i]=1;
while(m--){
int a,b;
gn(a);gn(b);
un(a,b+n);
un(a+n,b+n+n);
un(a+n+n,b);
un(a+3*n,b+3*n);
}
ll su=0;
rep(i,1,n+1)if(gf(i+3*n)==i+3*n){
if(gf(i)==gf(i+n) || gf(i+n)==gf(i+2*n) || gf(i+2*n)==gf(i)){
su+=1ll*sz[i+3*n]*sz[i+3*n];
}else{
else su+=1ll*sz[i]*sz[i+n]+1ll*sz[i+n]*sz[i+2*n]+1ll*sz[i+2*n]*sz[i];
}
}
cout<<su<<endl;
#ifdef JCVB
debug("time: %d\n",int(clock()-_time_jc));
#endif
return 0;
}
| a.cc: In function 'int main()':
a.cc:124:25: error: expected '}' before 'else'
124 | else su+=1ll*sz[i]*sz[i+n]+1ll*sz[i+n]*sz[i+2*n]+1ll*sz[i+2*n]*sz[i];
| ^~~~
a.cc:123:22: note: to match this '{'
123 | }else{
| ^
a.cc:124:25: error: expected '}' before 'else'
124 | else su+=1ll*sz[i]*sz[i+n]+1ll*sz[i+n]*sz[i+2*n]+1ll*sz[i+2*n]*sz[i];
| ^~~~
a.cc:120:41: note: to match this '{'
120 | rep(i,1,n+1)if(gf(i+3*n)==i+3*n){
| ^
a.cc: At global scope:
a.cc:128:9: error: expected declaration before '}' token
128 | }
| ^
a.cc:129:9: error: 'cout' does not name a type
129 | cout<<su<<endl;
| ^~~~
a.cc:134:9: error: expected unqualified-id before 'return'
134 | return 0;
| ^~~~~~
a.cc:135:1: error: expected declaration before '}' token
135 | }
| ^
|
s532962762 | p03957 | C++ | #include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>
#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a) (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define pb push_back
#define sz size()
using namespace std;
using ll = long long int;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int MOD = 1e9 + 7;
const ll ZER = 0;
int main(){
string s;
cin >> s;
bool f = false;
rep(i, s.sz){
if(s[i] == "C")f = true;
if(s[i] == "F" && f){
cout << "Yes" << endl;
return 0;
}
}
cout << "No" << endl;
}
| a.cc: In function 'int main()':
a.cc:46:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
46 | if(s[i] == "C")f = true;
a.cc:47:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
47 | if(s[i] == "F" && f){
|
s317082639 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const intll INF = 100000000000000000;
const int MOD = 1e9 + 7;
int main() {
string s;
cin >> s ;
bool OK = false ;
rep(i,s.size()){
if(s.at(i) == 'C') OK = true ;
if(OK && s.at(i) == 'F'){
cout << "Yes" <<endl;
return 0 ;
}
cout << "No" <<endl ;
}
| a.cc: In function 'int main()':
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:10:12: note: to match this '{'
10 | int main() {
| ^
|
s573064056 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
{
if(s[i]=='C')
{
for(register int j=i+1;j<l;j++)
{
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
}
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:15:42: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s459317772 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
for(int i=0;i< s.size();i++){
cin>>s[i];
if(S[i]=="C"){
for(int j=i+1;j<s.size();j++){
int s[j];
if(s[j]=="F"){
cout<<"Yes"<<endl;
}
else if(s[j]!="F"){
cout<<"No"<<endl;
}
}
}
else if(s[i]!="C"){
cout<<"No"<<endl;
}
}
} | a.cc: In function 'int main()':
a.cc:8:8: error: 'S' was not declared in this scope
8 | if(S[i]=="C"){
| ^
a.cc:11:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if(s[j]=="F"){
| ~~~~^~~~~
a.cc:14:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | else if(s[j]!="F"){
| ~~~~^~~~~
a.cc:19:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
19 | else if(s[i]!="C"){
|
s084274318 | p03957 | C++ | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
strin s;
int ans=0;
cin >>s;
rep(i, s.size()) { ans |= (s[i] == 'C');
if (ans != 0) {
ans |= (s[i] == 'F') << 1;
}
}
cout<<solve(ans==3)<<endl;
} | a.cc: In function 'int main()':
a.cc:29:9: error: 'strin' was not declared in this scope; did you mean 'stdin'?
29 | strin s;
| ^~~~~
| stdin
a.cc:31:15: error: 's' was not declared in this scope
31 | cin >>s;
| ^
|
s345580571 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
int main() {
string s;
cin >> s;
bool flag1 = false,flag2 = false;
rep(i,n){
if(s.at(i)=='C')flag1 = true;
if(flag1&&s.at(i)=='F')flag2=true;
}
cout <<(flag2?"Yes":"No")<< endl;
}
| a.cc: In function 'int main()':
a.cc:12:7: error: 'n' was not declared in this scope
12 | rep(i,n){
| ^
a.cc:3:45: note: in definition of macro 'rep'
3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
| ^
|
s191720926 | p03957 | C++ | #include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
string S;
cin>>S;
int N=S.size();
int K=-1;
for(int i=0;i<N-1;i++){
if(S[i]=='C'){
K=i;
break;
}
}
if(K==-1) cout<<"No";
int x=1;
else{
for(int i=K+1;i<N;i++){
if(S[i]=='F'){
cout<<"Yes";
x*=0;
break;
}
}
if(x==1) cout<<"No";
}
return 0;}
| a.cc: In function 'int main()':
a.cc:61:5: error: 'else' without a previous 'if'
61 | else{
| ^~~~
|
s103493934 | p03957 | C++ | #include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
string S;
cin>>S;
int N=S.size();
int K=-1;
for(int i=0;i<N-1;i++){
if(S[i]=='C'){
K=i;
break;
}
if(K==-1) cout<<"No";
int x=1;
else{
for(int i=K+1;i<N;i++){
if(S[i]=='F'){
cout<<"Yes";
x*=0;
break;
}
}
if(x==1) cout<<"No";
}
return 0;}
| a.cc: In function 'int main()':
a.cc:60:5: error: 'else' without a previous 'if'
60 | else{
| ^~~~
a.cc:70:11: error: expected '}' at end of input
70 | return 0;}
| ^
a.cc:48:11: note: to match this '{'
48 | int main(){
| ^
|
s739761247 | p03957 | C++ | #include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
string S;
cin>>S;
int N=S.size();
int K=-1;
for(int i=0;i<N-1;i++){
if(S[i]=='C'){
K=i;
break;
}
if(K=-1) cout<<"No";
int x=1;
else{
for(int i=K+1;i<N;i++){
if(S[i]=='F'){
cout<<"Yes";
x*=0;
break;
}
}
if(x==1) cout<<"No";
}
return 0;}
| a.cc: In function 'int main()':
a.cc:60:5: error: 'else' without a previous 'if'
60 | else{
| ^~~~
a.cc:70:11: error: expected '}' at end of input
70 | return 0;}
| ^
a.cc:48:11: note: to match this '{'
48 | int main(){
| ^
|
s778611457 | p03957 | C++ | #include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
string S;
cin>>A>>B;
int N=S.size();
int K=-1;
for(int i=0;i<N-1;i++){
if(S[i]=='C'){
K=i;
break;
}
if(K=-1) cout<<"No";
int x=1;
else{
for(int i=K+1;i<N;i++){
if(S[i]=='F'){
cout<<"Yes";
x*=0;
break;
}
}
if(x==1) cout<<"No";
}
return 0;} | a.cc: In function 'int main()':
a.cc:50:8: error: 'A' was not declared in this scope
50 | cin>>A>>B;
| ^
a.cc:50:11: error: 'B' was not declared in this scope
50 | cin>>A>>B;
| ^
a.cc:60:5: error: 'else' without a previous 'if'
60 | else{
| ^~~~
a.cc:70:11: error: expected '}' at end of input
70 | return 0;}
| ^
a.cc:48:11: note: to match this '{'
48 | int main(){
| ^
|
s702816825 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
int a=s.length();
int i,j;
int k=0;
for(i=0;i<a;i++){
if(s[i]=="C"){
k=1;
break;
}
}
if(k==1){
for(j=i;j<a;j++){
if(s[j]=="F"){
cout<<"YES"<<endl;
return 0;
}
}
}
cout<<"NO"<<endl;
} | a.cc: In function 'int main()':
a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s[i]=="C"){
a.cc:17:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
17 | if(s[j]=="F"){
|
s265845482 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S;
cin>>S;
bool A=false;
bool B=false;
for(int i=0;i<S.size();i++){
if(S.at(i)=='C'&&A==false)A=true;
if(S.at(i)=='F'&&A==true){
cout<<"Yes"<<endl;
}
if(i==S.size()-1)B=true;
}
if(B==true){cout<<"No"<<endl;
}
| a.cc: In function 'int main()':
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s285400711 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S;
cin>>S;
bool A=false;
bool B=false;
for(int i=0;i<S.size(),i++){
if(S.at(i)=='C'&&A==false)A=true;
if(S.at(i)=='F'&&A==true){
cout<<"Yes"<<endl;
}
if(i==S.size()-1)B=true;
}
if(B==true){cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:8:29: error: expected ';' before ')' token
8 | for(int i=0;i<S.size(),i++){
| ^
| ;
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s312899686 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string S;
cin>>S;
bool A=false;
bool B=false;
for(int i=0;i<S.size,i++){
if(S.at(i)=='C'&&A==false)A=true;
if(S.at(i)=='F'&&A==true){
cout<<"Yes"<<endl;
}
if(i==S.size()-1)B=true;
}
if(B==true){cout<<"No"<<endl;
} | a.cc: In function 'int main()':
a.cc:8:19: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
8 | for(int i=0;i<S.size,i++){
| ~~^~~~
| ()
a.cc:8:27: error: expected ';' before ')' token
8 | for(int i=0;i<S.size,i++){
| ^
| ;
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s691203175 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000; // n の最大値
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
int main() {
string s;
cin>>s;
ll k=0;
ll g=0;
ll r=0;
for(ll i=0; i<(ll)s.size(); i++){
if(s.at(i)=='C'){
k=i;
r++;
break;}}
for(ll i=s.size(); i>k; i--){
if(s.at(i)=='F'){
g=i;
r++;
break;}}
if(r==2) cout<< "Yes" << endl;
else cout << "No" << endl;}
else{
cout << "No" << endl;}}
| a.cc:37:1: error: expected unqualified-id before 'else'
37 | else{
| ^~~~
a.cc:38:23: error: expected declaration before '}' token
38 | cout << "No" << endl;}}
| ^
|
s850585353 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000; // n の最大値
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
int main() {
string s;
cin>>s;
ll k=0;
ll g=0;
ll r=0;
for(ll i=0; i<s.size(); i++){
if(s.at(i)=='C'){
k=i;
r++;
break;}}
for(ll i=s.size(); i>k; i--){
if(s.at(i)=='F'){
g=i;
r++;
break;}}
if(r==2) cout<< "Yes" << endl;
else cout << "No" << endl;}
else{
cout << "No" << endl;}}
| a.cc:37:1: error: expected unqualified-id before 'else'
37 | else{
| ^~~~
a.cc:38:23: error: expected declaration before '}' token
38 | cout << "No" << endl;}}
| ^
|
s120571550 | p03957 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void){
string s;
cin >> s;
bool a,b;
for( int i = 0; i<16;++i){
if(s[i]=='C')a = true;
if(s[i]=='F' && a ) b = true;
}
cout << b ? "Yes" : "No" << endl;
} | a.cc: In function 'int main()':
a.cc:17:26: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
17 | cout << b ? "Yes" : "No" << endl;
| ~~~~~^~~~~~~
|
s751660799 | p03957 | C | #include <iostream>
#include <string>
using namespace std;
int ans = 0;
string s;
int main()
{
cin >> s;
for(int i = 0; i < s.size(); i++)
{
if(s[i] == 'C')
{
ans++;
}
if(s[i] == 'F' && ans)
{
cout << "Yes";
return 0;
}
}
cout << "No";
return 0;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s210329235 | p03957 | C++ | #include <iostream>
#include <string>
using namespace std;
int ans = 0;
string s;
int main()
{
cin >> s;
for(int i = 0; i < s.size(); i++)
{
if(a[i] == 'c')
{
ans ++;
}
if(a[i] == 'f' && ans)
{
cout << "Yes";
return 0;
}
}
cout << "No";
return 0;
} | a.cc: In function 'int main()':
a.cc:11:20: error: 'a' was not declared in this scope
11 | if(a[i] == 'c')
| ^
a.cc:15:20: error: 'a' was not declared in this scope
15 | if(a[i] == 'f' && ans)
| ^
|
s640205412 | p03957 | C++ | using namespace std;
int main(){
string a;
cin>>a;
int cnt=0;
for(int i=0;i<a.size();i++){
if(a[i]=='C'){
cnt=1;
}
if(a[i]=='F'&&cnt==1){
cout<<"Yes";
return 0;
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int main()':
a.cc:3:5: error: 'string' was not declared in this scope
3 | string a;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | using namespace std;
a.cc:4:5: error: 'cin' was not declared in this scope
4 | cin>>a;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:4:10: error: 'a' was not declared in this scope
4 | cin>>a;
| ^
a.cc:11:13: error: 'cout' was not declared in this scope
11 | cout<<"Yes";
| ^~~~
a.cc:11:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:5: error: 'cout' was not declared in this scope
15 | cout<<"No";
| ^~~~
a.cc:15:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s950083736 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s ;
cin >> s ;
int a = 0;
int b = 0 ;
int c = 0 ;
int d = 0 ;
for ( int i = 0 ; i < s.size() ; i++){
if (s.at(i) == 'C') {a = 1 ;
C = i ;
break;
}
}
for ( int i = 0 ; i < s.size() ; i++){
if (s.at(i) == 'F') {b = 1 ;
d = i ;
break;
}
}
if ( a==1 && b == 1 && c < d) cout << "Yes" << endl ;
else cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 'C' was not declared in this scope
23 | C = i ;
| ^
|
s245188697 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s ;
cin >> s ;
int a = 0;
int b = 0 ;
int c = 0 ;
int d = 0 ;
for ( int i = 0 ; i < s.size() ; i++){
if (s.at(i) == 'C') {a = 1 ;
C = i
break;
}
}
for ( int i = 0 ; i < s.size() ; i++){
if (s.at(i) == 'F') {b = 1 ;
break;
d = i
}
}
if ( a==1 && b == 1 && c < d) cout << "Yes" << endl ;
else cout << "No" << endl;
} | a.cc: In function 'int main()':
a.cc:23:9: error: 'C' was not declared in this scope
23 | C = i
| ^
a.cc:37:14: error: expected ';' before '}' token
37 | d = i
| ^
| ;
38 |
39 | }
| ~
|
s252973049 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string a;
cin>>a;
for(int i=0;i<a.size()){
if(a[i]=='c'){
for(int j=i+1;j<a.size();j++){
if(a[i]=='f'){
cout<<"Yes"<<endl; return 0;
}
}
}
}
cout<<"No"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:31: error: expected ';' before ')' token
6 | for(int i=0;i<a.size()){
| ^
| ;
|
s428061424 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
{
if(s[i]=='C')
{
for(register int j=i+1;j<l;j++)
{
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
}
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:15:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s504048639 | p03957 | C++ | #include<iostream>
using namespace syd;
int main() {
bool flag = false;
char tmp;
while(cin >> tmp) {
if (flag && tmp == 'F') {
cout << "Yes" << endl;
return 0;
}
else if (!flag && tmp == 'C') {
flag = true;
}
}
cout << "No" << endl;
} | a.cc:2:17: error: 'syd' is not a namespace-name
2 | using namespace syd;
| ^~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | while(cin >> tmp) {
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
9 | cout << "Yes" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:9:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
9 | cout << "Yes" << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:16:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
16 | cout << "No" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:16:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
16 | cout << "No" << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s217452701 | p03957 | C++ | #include<iostream>
using namespace syd;
int main() {
bool flag = false;
char tmp;
while(cin >> tmp) {
if (flag && tmp == 'F') {
cout << "Yes" << endl;
return 0;
}
else if (!flag && tmp == 'C') {
flag = true;
}
}
cout << "No" << endl; | a.cc:2:17: error: 'syd' is not a namespace-name
2 | using namespace syd;
| ^~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | while(cin >> tmp) {
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
9 | cout << "Yes" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:9:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
9 | cout << "Yes" << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:16:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
16 | cout << "No" << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:16:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
16 | cout << "No" << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:16:24: error: expected '}' at end of input
16 | cout << "No" << endl;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s052973003 | p03957 | C++ | #include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
using namespace std;
int main(void){
string s;
cin >> s;
int state = 0;
for (int i = 0; i < s.size(); i++){
if (s == 0){
if (s[i] == 'C')
s++;
}
else if (s == 1)
if (s[i] == 'F')
s++;
}
if (s == 2)
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:11: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
14 | if (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: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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if (s == 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:14:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if (s == 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:14:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if (s == 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:14:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
14 | if (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: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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
14 | if (s == 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:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
14 | if (s == 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 allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:14:14: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
14 | if (s == 0){
| ^
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:14:14: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
14 | if (s == 0){
| ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool s |
s140056001 | p03957 | C++ | #include<stdio.h>
int main()
{char a[101];
int q=0;
int s=0;
scanf("%s",a);
int l=strlen(a);
int i,j;
for(i=0;i<l;i++)
{if(a[i]=='C'){
q=1;
for(j=i+1;j<l;j++)
{
if(a[j]=='F'){
printf("Yes");
s=1;
break;
}
}
if(s==0)printf("No");
}
}
if(q==0)
printf("No");
return 0;
} | a.cc: In function 'int main()':
a.cc:9:7: error: 'strlen' was not declared in this scope
9 | int l=strlen(a);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<stdio.h>
+++ |+#include <cstring>
2 |
|
s303877743 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
{
if(s[i]=='C')
{
for(register int j=i+1;j<l;j++)
{
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
}
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:15:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s954856214 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
{
if(s[i]=='C')
{
for(register int j=i+1;j<l;j++)
{
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
}
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:15:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s159869525 | p03957 | C++ | #include<iostream>
using namespace std;
bool flag[3];
int main(){
string a;
cin>>a;
for(int i=0;i<a.length();++i){
if(a[i]=='C')v[0]=1;
if(a[i]=='F'&&v[0])v[1]=1;
}
if(v[1])cout<<"Yes";
else cout<<"No";
return 0;
} | a.cc: In function 'int main()':
a.cc:8:22: error: 'v' was not declared in this scope
8 | if(a[i]=='C')v[0]=1;
| ^
a.cc:9:23: error: 'v' was not declared in this scope
9 | if(a[i]=='F'&&v[0])v[1]=1;
| ^
a.cc:11:8: error: 'v' was not declared in this scope
11 | if(v[1])cout<<"Yes";
| ^
|
s796994376 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
char s[205];
int flag;
int main(){
scanf("%s",s);
int n=strlen(s);
for(register int i=0;i<n;++i){
if(s[i]=='C')flag=1;
if(s[i]=='F'&&flag==1)cout<<"Yes\n";
else cout<<"No\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<n;++i){
| ^
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:8:11: note: to match this '{'
8 | int main(){
| ^
|
s832777538 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
char s[205];
int flag;
int main(){
scanf("%s",s);
int n=strlen(s);
for(register int i=0;i<n;++i){
if(s[i]=='C')flag1=1;
if(s[i]=='F'&&flag1==1)cout<<"Yes\n";
else cout<<"No\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<n;++i){
| ^
a.cc:12:22: error: 'flag1' was not declared in this scope; did you mean 'flag'?
12 | if(s[i]=='C')flag1=1;
| ^~~~~
| flag
a.cc:13:23: error: 'flag1' was not declared in this scope; did you mean 'flag'?
13 | if(s[i]=='F'&&flag1==1)cout<<"Yes\n";
| ^~~~~
| flag
a.cc:16:2: error: expected '}' at end of input
16 | }
| ^
a.cc:8:11: note: to match this '{'
8 | int main(){
| ^
|
s367820623 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
{
if(s[i]=='C')
{
for(register int j=i+1;j<l;j++)
{
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
}
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:15:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s689358094 | p03957 | 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() {
string s;
cin >> s;
string t = s;
reverse(t.begin(), t.end());
string ans = "No";
if (s.find != string::npos && s.find('F') != string::npos && s.find('C') < t.size() - t.find('F') - 1) ans = "Yes";
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:13:16: error: invalid operands of types '<unresolved overloaded function type>' and 'const std::__cxx11::basic_string<char>::size_type' {aka 'const long unsigned int'} to binary 'operator!='
13 | if (s.find != string::npos && s.find('F') != string::npos && s.find('C') < t.size() - t.find('F') - 1) ans = "Yes";
| ~~~~~~ ^~ ~~~~~~~~~~~~
| | |
| | const std::__cxx11::basic_string<char>::size_type {aka const long unsigned int}
| <unresolved overloaded function type>
|
s412934337 | p03957 | C++ | int main(void)
{
char N[101];
int i,flag=0;
scanf("%s", &N);
for (i = 0; i < 100; i++) {
if (N[i] == 'C')
{
flag = 1; continue;
}
if(flag==1 &&N[i] == 'F')
{
printf("Yes"); return 0;
}
}
printf("No");
return 0;
} | a.cc: In function 'int main()':
a.cc:5:9: error: 'scanf' was not declared in this scope
5 | scanf("%s", &N);
| ^~~~~
a.cc:13:25: error: 'printf' was not declared in this scope
13 | printf("Yes"); return 0;
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main(void)
a.cc:16:9: error: 'printf' was not declared in this scope
16 | printf("No");
| ^~~~~~
a.cc:16:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
|
s897885265 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
bool flag1 = false;
bool flag2 = false;
for(char i:s){
if(i=='C') flag1 = true;
if(i=='F') flag2 = true;
}
if(flag1==true&&flag==true) cout << "Yes" << endl;
else cout << "No" << endl;
}
| a.cc: In function 'int main()':
a.cc:13:21: error: 'flag' was not declared in this scope; did you mean 'flag2'?
13 | if(flag1==true&&flag==true) cout << "Yes" << endl;
| ^~~~
| flag2
|
s198511784 | p03957 | C++ | v | a.cc:1:1: error: 'v' does not name a type
1 | v
| ^
|
s918029904 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
cin>>a;
int ans=0;
for(int i=0;i<a.size();i++)
{
if(a[i]=='C')
{
ans=1;
}
if(a[i]=='F'&&cnt==1){
cout<<"Yes";
return 0;
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int main()':
a.cc:14:23: error: 'cnt' was not declared in this scope; did you mean 'int'?
14 | if(a[i]=='F'&&cnt==1){
| ^~~
| int
|
s388638495 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
{
if(s[i]=='C')
{
for(register int j=i+1;j<l;j++)
{
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
}
}
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:15:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
15 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s225852208 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main(){
cin>>s;
if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
else cout<<“No”;
return 0;
} | a.cc:6:15: error: extended character ‘ is not valid in an identifier
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^
a.cc:6:15: error: extended character ’ is not valid in an identifier
a.cc:6:32: error: extended character ‘ is not valid in an identifier
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^
a.cc:6:32: error: extended character ’ is not valid in an identifier
a.cc:6:47: error: extended character “ is not valid in an identifier
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^
a.cc:6:47: error: extended character ” is not valid in an identifier
a.cc:7:20: error: extended character ’ is not valid in an identifier
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^
a.cc:7:20: error: extended character ’ is not valid in an identifier
a.cc:7:32: error: extended character ‘ is not valid in an identifier
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^
a.cc:7:32: error: extended character ’ is not valid in an identifier
a.cc:7:43: error: extended character “ is not valid in an identifier
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^
a.cc:7:43: error: extended character ” is not valid in an identifier
a.cc:8:16: error: extended character “ is not valid in an identifier
8 | else cout<<“No”;
| ^
a.cc:8:16: error: extended character ” is not valid in an identifier
a.cc: In function 'int main()':
a.cc:6:15: error: '\U00002018C\U00002019' was not declared in this scope
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^~~
a.cc:6:32: error: '\U00002018F\U00002019' was not declared in this scope
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^~~
a.cc:6:47: error: '\U0000201cNo\U0000201d' was not declared in this scope
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^~~~
a.cc:7:20: error: '\U00002019C\U00002019' was not declared in this scope
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^~~
a.cc:7:43: error: '\U0000201cYes\U0000201d' was not declared in this scope
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^~~~~
a.cc:8:16: error: '\U0000201cNo\U0000201d' was not declared in this scope
8 | else cout<<“No”;
| ^~~~
|
s576747332 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
string s;
int main{
cin>>s;
if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
else cout<<“No”;
return 0;
} | a.cc:6:15: error: extended character ‘ is not valid in an identifier
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^
a.cc:6:15: error: extended character ’ is not valid in an identifier
a.cc:6:32: error: extended character ‘ is not valid in an identifier
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^
a.cc:6:32: error: extended character ’ is not valid in an identifier
a.cc:6:47: error: extended character “ is not valid in an identifier
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^
a.cc:6:47: error: extended character ” is not valid in an identifier
a.cc:7:20: error: extended character ’ is not valid in an identifier
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^
a.cc:7:20: error: extended character ’ is not valid in an identifier
a.cc:7:32: error: extended character ‘ is not valid in an identifier
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^
a.cc:7:32: error: extended character ’ is not valid in an identifier
a.cc:7:43: error: extended character “ is not valid in an identifier
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^
a.cc:7:43: error: extended character ” is not valid in an identifier
a.cc:8:16: error: extended character “ is not valid in an identifier
8 | else cout<<“No”;
| ^
a.cc:8:16: error: extended character ” is not valid in an identifier
a.cc:4:5: error: cannot declare '::main' to be a global variable
4 | int main{
| ^~~~
a.cc:5:11: error: expected '}' before ';' token
5 | cin>>s;
| ^
a.cc:4:9: note: to match this '{'
4 | int main{
| ^
a.cc:5:8: error: invalid user-defined conversion from 'std::basic_istream<char>' to 'int' [-fpermissive]
5 | cin>>s;
| ~~~^~~
In file included from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/bits/basic_ios.h:121:16: note: candidate is: 'std::basic_ios<_CharT, _Traits>::operator bool() const [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
121 | explicit operator bool() const
| ^~~~~~~~
/usr/include/c++/14/bits/basic_ios.h:121:16: note: return type 'bool' of explicit conversion function cannot be converted to 'int' with a qualification conversion
a.cc:6:5: error: expected unqualified-id before 'if'
6 | if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
| ^~
a.cc:7:5: error: expected unqualified-id before 'else'
7 | else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
| ^~~~
a.cc:8:5: error: expected unqualified-id before 'else'
8 | else cout<<“No”;
| ^~~~
a.cc:9:5: error: expected unqualified-id before 'return'
9 | return 0;
| ^~~~~~
a.cc:10:1: error: expected declaration before '}' token
10 | }
| ^
|
s358664645 | p03957 | C++ | #include<bits/c++.h>
using namespace std;
string s;
int main{
cin>>s;
if(s.find(‘C’)==-1||s.find(‘F’)==-1)cout<<“No”;
else if(s.find(’C’)<s.find(‘F’))cout<<“Yes”;
else cout<<“No”;
return 0;
} | a.cc:1:9: fatal error: bits/c++.h: No such file or directory
1 | #include<bits/c++.h>
| ^~~~~~~~~~~~
compilation terminated.
|
s036116031 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
if(s[i]=='C')
for(register int j=i+1;j<l;j++)
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:13:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
13 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s515329934 | p03957 | C++ | #include<iostream>
#include<cstdio>
#include<string>
using namespace std;
string s;
int l;
int mian()
{
cin>>s;
l=s.size();
for(register int i=0;i<l;i++)
if(s[i]=='C')
for(register int j=i+1;j<l;j++)
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
cout<<"No";
return 0;
} | a.cc: In function 'int mian()':
a.cc:11:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
11 | for(register int i=0;i<l;i++)
| ^
a.cc:13:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
13 | for(register int j=i+1;j<l;j++)
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s941150735 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
string s;
int mian()
{
cin>>s;
for(int i=0;i<s.size();i++)
if(s[i]=='C')
for(int j=i+1;j<s.size();j++)
if(s[j]=='F')
{
cout<<"Yes";
return 0;
}
cout<<"No";
return 0;
} | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s715703421 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
char s;
cin>>s;
int len=strlen(s);
for(int i=0; i<len; i++)
for(int j=i+1; j<len; j++)
if(i=='C' && j=='F')
{
cout<<"YES";
return 0;
}
cout<<"NO";
return 0;
} | a.cc: In function 'int main()':
a.cc:8:20: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
8 | int len=strlen(s);
| ^
| |
| char
In file included from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
|
s596451313 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int len=strlen(s);
for(int i=0; i<len; i++)
for(int j=i+1; j<len; j++)
if(i=='C' && j=='F')
{
cout<<"YES";
return 0;
}
cout<<"NO";
return 0;
} | a.cc: In function 'int main()':
a.cc:8:20: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
8 | int len=strlen(s);
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
|
s499951301 | p03957 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int len=strlen(s);
for(int i=0; i<len; i++)
for(int j=i+1; j<len; j++)
if(i=='C' && j=='F')
{
cout<<"YES";
return 0;
}
cout<<"NO";
return 0;
} | a.cc: In function 'int main()':
a.cc:8:20: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
8 | int len=strlen(s);
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/string.h:407:35: note: initializing argument 1 of 'size_t strlen(const char*)'
407 | extern size_t strlen (const char *__s)
| ~~~~~~~~~~~~^~~
|
s103026800 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
gets(s);
int l=0;
for (int i=0;i<s.size();i++){
if (s[i]=='C') l=1;
if (s[i]=='F' && l==1){
printf("Yes\n");
return 0;
}
}
printf("No\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:5:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
5 | gets(s);
| ^~~~
| getw
|
s563968502 | p03957 | C++ | #include<bits/stdc++.h>
using namespace std;
inline int read()
{
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9') {if(c=='-') f=-1; c=getchar();}
while(c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
return f*x;
}
inline void write(int x)
{
if(x<0) {putchar('-'); x=-x;}
if(x>9) write(x/10);
putchar(x%10+'0');
}
int main(){
string s;
cin>>s;
for (int i=0;i<s.length();i++){
if (s[i]=='C'){
num=1;
}
if (s[i]=='F'&&num==1){
cout<<"Yes";
}
}
cout<<"No";
return 0;
}
| a.cc: In function 'int main()':
a.cc:22:25: error: 'num' was not declared in this scope; did you mean 'enum'?
22 | num=1;
| ^~~
| enum
a.cc:24:32: error: 'num' was not declared in this scope; did you mean 'enum'?
24 | if (s[i]=='F'&&num==1){
| ^~~
| enum
|
s430272081 | p03957 | C++ | #include<iostream>
using namespace std;
int main()
{
int temp=0;
char le;
while(cin>>le)
{
if(le=='C') temp++;
if(temp==1&&le=='F') temp++;
if(temp==2)
{
cout<<"Yes"<<endl;
num++;
return 0;
}
}
cout<<"No"<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:25: error: 'num' was not declared in this scope; did you mean 'enum'?
14 | num++;
| ^~~
| enum
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.