Submission #1779812


Source Code Expand

#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;
}

Submission Info

Submission Time
Task E - Rotate 3x3
User vjudge3
Language C++14 (GCC 5.4.1)
Score 0
Code Size 970 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:39:5: error: ‘ll’ was not declared in this scope
     ll cnt[2]={0,0},nxd[2]={0,0};
     ^
./Main.cpp:39:20: error: expected primary-expression before ‘,’ token
     ll cnt[2]={0,0},nxd[2]={0,0};
                    ^
./Main.cpp:39:21: error: ‘nxd’ was not declared in this scope
     ll cnt[2]={0,0},nxd[2]={0,0};
                     ^
./Main.cpp:40:36: error: ‘cnt’ was not declared in this scope
     rep(i,1,n+1)if(data[0][i]%3==0)cnt[i%2]++;
                                    ^
./Main.cpp:43:8: error: ‘cnt’ was not declared in this scope
     if(cnt[0]%2==nxd[1]%2&&cnt[1]%2==nxd[0]%2)puts("Yes");
        ^
./Main.cpp:18:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
./Main.cpp:19:50: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     rep(j,0,3)rep(i,1,n+1)s...