이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <ll, pii> piii;
typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> OST;
const ll NMAX = 100001;
const ll INF = (1LL << 60);
const ll MOD = 1000000007;
const ll BLOCK = 101;
const ll nr_of_bits = 35;
bitset <501 * 501> init, b, nou, cop;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m, t;
cin >> n >> m >> t;
int cc = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
char c;
cin >> c;
if(c != '#'){
cc++;
init[i * (m + 2) + j + 1].flip();
}
}
}
string s;
cin >> s;
b = init;
m+=2;
n+=2;
for(int i = 0; i < s.size(); i++){
if(s[i] != '?'){
if(s[i] == 'E'){
b <<= 1;
}else if(s[i] == 'W'){
b >>= 1;
}else if(s[i] == 'N'){
b >>= m;
}else{
b <<= m;
}
b &= init;
}else{
cop = b;
nou = b;
nou <<= 1;
nou &= init;
b = nou;
nou = cop;
nou >>= 1;
nou &= init;
b |= nou;
nou = cop;
nou >>= m;
nou &= init;
b |= nou;
nou = cop;
nou <<= m;
nou &= init;
b |= nou;
b &= init;
}
}
cout << b.count();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
nautilus.cpp: In function 'int main()':
nautilus.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for(int i = 0; i < s.size(); i++){
| ~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |