제출 #594073

#제출 시각아이디문제언어결과실행 시간메모리
594073Cross_Ratio영역 (JOI16_ho_t4)C++14
15 / 100
49 ms6764 KiB
#include <bits/stdc++.h> #define int long long using namespace std; typedef pair<int,int> P; signed main() { cin.sync_with_stdio(false); cin.tie(0); cout.tie(0); int N; int K; cin >> N >> K; string s; cin >> s; int i, j; int x = 0, y = 0; set<P> S; S.insert(P(0,0)); for(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--; S.insert(P(x,y)); } int ans = 0; for(P k : S) { int x = k.first, y = k.second; if(S.find(P(x,y+1))!=S.end()&&S.find(P(x+1,y))!=S.end()&&S.find(P(x+1,y+1))!=S.end()) { ans++; } } cout << ans; }

컴파일 시 표준 에러 (stderr) 메시지

2016_ho_t4.cpp: In function 'int main()':
2016_ho_t4.cpp:14:12: warning: unused variable 'j' [-Wunused-variable]
   14 |     int i, j;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...