| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 117170 | onjo0127 | 영역 (JOI16_ho_t4) | C++11 | 89 ms | 11256 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
set<pii> st;
char S[100009];
int cnt(set<pii> S) {
int ret = 0;
for(auto& it: S) {
int x, y; tie(x, y) = it;
if(S.find({x+1, y}) != S.end() && S.find({x, y+1}) != S.end() && S.find({x+1, y+1}) != S.end()) ++ret;
}
return ret;
}
set<pii> rep(set<pii>& S, int K, int dx, int dy) {
set<pii> ret;
for(int i=0; i<K; i++) {
for(auto& it: S) {
int x, y; tie(x, y) = it;
ret.insert({x + dx*i, y + dy*i});
}
}
return ret;
}
int main() {
int N, K; scanf("%d%d",&N,&K);
int x = 0, y = 0; st.insert({0, 0});
for(int i=1; i<=N; i++) {
scanf(" %c",&S[i]);
if(S[i] == 'N') ++y;
if(S[i] == 'S') --y;
if(S[i] == 'E') ++x;
if(S[i] == 'W') --x;
st.insert({x, y});
}
if(K == 1) printf("%d", cnt(st));
else {
int t = cnt(rep(st, K, x, y));
if(K <= 500) printf("%d", t);
else printf("%lld", 1LL * (cnt(rep(st, 501, x, y)) - t) * (K - 500) + t);
}
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
