답안 #412306

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
412306 2021-05-26T17:04:23 Z model_code 육각형 영역 (APIO21_hexagon) C++17
11 / 100
256 ms 16212 KB
#include "hexagon.h"
#include <bits/stdc++.h>
#define pii pair<int,int>
#define i1 first
#define i2 second
using namespace std;

const int MAXL=2e3+10;
const long long MOD=1e9+7;
const int dx[]={0,-1,-1,0,1,1,0};
const int dy[]={0,0,1,1,0,-1,-1};

int vis[MAXL][MAXL];
long long now, step, ans;
queue <pii> Q;

void add(int x,int y,int z) {
  if (x<0||y<0||x>=MAXL||y>=MAXL) {
    if (x+y==-2) {
      now=(now+step)%MOD;
      Q.push({x,y});
    }
  }
  else if (vis[x][y]<=z) {
    ans=(ans+now)%MOD;
    vis[x][y]=2;
    Q.push({x,y});
  }
}

void bfs(int x,int y,int z) {
  add(x,y,z);
  if (z) add(-1,-1,z);
  while ((int)Q.size()>z) {
    x=Q.front().i1;
    y=Q.front().i2;
    Q.pop();
    if (x<0) {
      add(x,y,z);
      continue;
    }
    for (int i=1;i<=6;i++) {
      add(x+dx[i],y+dy[i],z);
    }
  }
}

int draw_territory(int N, int A, int B, vector<int> D, vector<int> L) {
  int x=MAXL/2, y=MAXL/2;
  for (int i=0;i<N;i++) {
    for (int j=0;j<L[i];j++) {
      vis[x][y]=1;
      x+=dx[D[i]];
      y+=dy[D[i]];
    }
  }
  bfs(0,0,0);
  now=A;
  step=B;
  bfs(x,y,1);
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 8564 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 8596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 220 ms 16028 KB Output is correct
2 Correct 208 ms 16096 KB Output is correct
3 Correct 213 ms 16104 KB Output is correct
4 Correct 223 ms 16064 KB Output is correct
5 Correct 215 ms 16068 KB Output is correct
6 Correct 202 ms 16088 KB Output is correct
7 Correct 202 ms 16052 KB Output is correct
8 Correct 246 ms 16100 KB Output is correct
9 Correct 212 ms 16096 KB Output is correct
10 Correct 217 ms 16104 KB Output is correct
11 Correct 224 ms 16060 KB Output is correct
12 Correct 226 ms 16008 KB Output is correct
13 Correct 209 ms 15992 KB Output is correct
14 Correct 256 ms 16052 KB Output is correct
15 Correct 235 ms 16116 KB Output is correct
16 Correct 252 ms 16080 KB Output is correct
17 Correct 203 ms 16040 KB Output is correct
18 Correct 196 ms 16080 KB Output is correct
19 Correct 226 ms 16108 KB Output is correct
20 Correct 213 ms 16028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 8504 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 14 ms 8592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 206 ms 16104 KB Output is correct
2 Correct 212 ms 16068 KB Output is correct
3 Correct 206 ms 16056 KB Output is correct
4 Correct 207 ms 16068 KB Output is correct
5 Correct 239 ms 16024 KB Output is correct
6 Correct 207 ms 16100 KB Output is correct
7 Correct 204 ms 16068 KB Output is correct
8 Correct 203 ms 16056 KB Output is correct
9 Correct 219 ms 16064 KB Output is correct
10 Correct 228 ms 16032 KB Output is correct
11 Correct 210 ms 15984 KB Output is correct
12 Correct 204 ms 16100 KB Output is correct
13 Correct 213 ms 16064 KB Output is correct
14 Correct 217 ms 16212 KB Output is correct
15 Correct 208 ms 16012 KB Output is correct
16 Correct 237 ms 16024 KB Output is correct
17 Correct 220 ms 16088 KB Output is correct
18 Runtime error 19 ms 8524 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 8520 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 201 ms 16100 KB Output is correct
2 Runtime error 16 ms 8504 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -