| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 241755 | dsjong | 영역 (JOI16_ho_t4) | C++14 | 1101 ms | 210948 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, bool>mp;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k;
string s;
cin>>n>>k>>s;
assert(k==1 || n<=60);
int x=0, y=0;
mp[{0, 0}]=true;
set<pair<int, int>>v;
v.insert({0, 0});
for(int i=0;i<n;i++){
if(s[i]=='E') x++;
if(s[i]=='W') x--;
if(s[i]=='N') y--;
if(s[i]=='S') y++;
mp[{x, y}]=true;
v.insert({x, y});
}
int dy=y, dx=x;
set<pair<int, int>>v2;
for(int i=0;i<k;i++){
for(auto [x, y]:v){
v2.insert({x+i*dx, y+i*dy});
mp[{x+i*dx, y+i*dy}]=true;
}
}
int cnt=0;
for(auto i:v2){
int x=i.first, y=i.second;
if(mp[{x+1, y}] && mp[{x, y+1}] && mp[{x+1, y+1}]){
cnt++;
}
}
cout<<cnt;
}
컴파일 시 표준 에러 (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... | ||||
