# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699772 |
2023-02-18T01:51:59 Z |
wcwu |
Kocka (COCI18_kocka) |
C++17 |
|
35 ms |
65536 KB |
#include <bits/stdc++.h>
//#include<random>
using namespace std;
/*#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("O3")*/
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")//for codeforces*/
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int, int> pii;
typedef map<ll, ll> mll;
const int MOD1=1e9+7;
const int MOD2=998244353;
const int iINF=INT_MAX;
const ll INF=LLONG_MAX;
const ld PI=3.14159265358979323846;
ll gcd(ll a,ll b){if(b==0) return a; return gcd(b,a%b);}
ll fpow(ll a,ll b,ll m) {
if(!b) return 1;
ll ans=fpow(a*a%m,b/2,m);
return (b%2?ans*a%m:ans);
}
ll inv(ll a,ll m) {return fpow(a,m-2,m);}
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define dbg(n) cerr<<#n<<": "<<n<<"\n";
#define optline cout<<"\n";
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define irep(i,m,n) for(ll i=m;i>=n;i--)
#define F first
#define S second
#define All(c) c.begin(), c.end()
#define pb push_back
#define eb emplace_back
//#define mp make_pair
#define uni(c) c.resize(distance(c.begin(), unique(c.begin(), c.end())))
#define unisort(c) sort(c.begin(), c.end());uni(c)
signed main() {
ll n;
cin>>n;
ll a[n+1][n+1];
rep(i, n+1) rep(j, n+1) a[i][j]=-1;
vector<ll> tmp(n+1);
rep1(i, n) {
cin>>tmp[i];
if(tmp[i]==-1) {
rep1(j, n) a[i][j]=0;
}
else {
for(int j=1;j<1+tmp[i];j++) {
a[i][j]=0;
}
a[i][1+tmp[i]]=1;
}
}
bool flag=1;
rep1(i, n) {
cin>>tmp[i];
if(tmp[i]==-1) {
rep1(j, n) {
if(a[i][j]==1) {
flag=0;
}
else a[i][j]=0;
}
}
else {
for(int j=n;j>n-tmp[i];j--) {
if(a[i][j]==1) flag=0;
else a[i][j]=0;
}
if(a[i][n-tmp[i]]==0) {
flag=0;
}
else a[i][n-tmp[i]]=1;
}
}
rep1(i, n) {
cin>>tmp[i];
if(tmp[i]==-1) {
rep1(j, n) {
if(a[j][i]==1) {
flag=0;
}
else a[j][i]=0;
}
}
else {
for(int j=1;j<1+tmp[i];j++) {
if(a[j][i]==1) flag=0;
else a[j][i]=0;
}
if(a[1+tmp[i]][i]==0) flag=0;
else a[1+tmp[i]][i]=1;
}
}
rep1(i, n) {
cin>>tmp[i];
if(tmp[i]==-1) {
rep1(j, n) {
if(a[j][i]==1) {
flag=0;
}
else a[j][i]=0;
}
}
else {
for(int j=n;j>n-tmp[i];j--) {
if(a[j][i]==1) flag=0;
else a[j][i]=0;
}
if(a[n-tmp[i]][i]==0) {
flag=0;
}
else a[n-tmp[i]][i]=1;
}
}
if(flag) cout<<"DA\n";
else cout<<"NE\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
8020 KB |
Output is correct |
2 |
Correct |
8 ms |
8060 KB |
Output is correct |
3 |
Correct |
8 ms |
8112 KB |
Output is correct |
4 |
Correct |
8 ms |
8108 KB |
Output is correct |
5 |
Correct |
7 ms |
8100 KB |
Output is correct |
6 |
Correct |
8 ms |
8020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
8148 KB |
Output is correct |
2 |
Correct |
5 ms |
8148 KB |
Output is correct |
3 |
Correct |
7 ms |
7996 KB |
Output is correct |
4 |
Correct |
5 ms |
8116 KB |
Output is correct |
5 |
Correct |
9 ms |
7996 KB |
Output is correct |
6 |
Correct |
11 ms |
8144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
28 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
29 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |