QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#534900 | #1127. Virus Experiment | Wansur# | 0 | 27ms | 9304kb | C++23 | 1.7kb | 2024-08-27 17:18:02 | 2024-08-27 17:18:02 |
Judging History
answer
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n'
#define int long long
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 12;
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
bool used[901][901];
int u[901][901];
int val[300], mx[10];
int n, m, k;
void solve(){
string s;
cin >> k >> n >> m;
cin >> s;
val['W'] = 0;
val['E'] = 1;
val['N'] = 2;
val['S'] = 3;
while(s.size() <= 1e5){
s += s;
}
for(int mask = 0;mask < 16; mask++){
for(int i=0;i<s.size();i++){
if(!(mask & (1 << val[s[i]]))) continue;
int j = i;
while(j + 1 < s.size() && (mask & (1 << val[s[j+1]]))){
j++;
}
val[mask] = max(val[mask], j - i + 1);
i = j;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin >> u[i][j];
}
}
int mx = 1e9, cnt = 0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(!u[i][j]) continue;
int l = j, r = j;
while(1){
if(l > 1 && u[i][l-1] <= val[1] && u[i][l-1]) l--;
else if(r < m && u[i][r+1] <= val[2] && u[i][r+1]) r++;
else break;
}
if(mx > r - l + 1) {
mx = r - l + 1;
cnt = 0;
}
if(mx == r - l + 1) cnt++;
}
}
cout << mx << ent << cnt << ent;
}
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t = 1;
// cin >> t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 14
Accepted
time: 2ms
memory: 3780kb
input:
53768 10 50 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...
output:
1 10
result:
ok 2 lines
Test #2:
score: 0
Wrong Answer
time: 27ms
memory: 9304kb
input:
10 800 800 WWWWEWWEWW 7 3 7 5 10 6 9 6 5 8 1 10 1 6 6 1 8 9 3 7 1 3 1 4 9 3 4 2 5 4 5 7 8 10 4 6 2 8 7 2 1 5 3 10 9 10 1 7 6 2 1 8 3 4 10 5 3 3 3 9 2 2 6 1 6 5 6 3 7 9 7 5 8 5 4 3 7 6 9 3 4 9 1 2 7 1 3 4 6 10 8 4 4 9 1 2 6 1 4 4 10 6 10 4 1 5 1 8 5 2 1 9 4 10 9 2 7 9 4 1 6 5 1 6 6 10 10 1 3 10 6 4 8...
output:
1 230276
result:
wrong answer 2nd lines differ - expected: '230450', found: '230276'
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 3ms
memory: 3760kb
input:
10 10 10 NNNNSENESS 3 2 0 0 1 3 2 3 1 2 3 3 2 0 5 2 4 0 5 1 5 1 2 3 0 4 4 0 1 0 5 0 1 0 2 4 2 2 0 3 0 1 0 1 4 0 1 4 1 0 3 5 5 0 2 5 3 0 3 4 5 3 1 0 5 4 4 0 4 4 1 0 2 0 5 4 0 2 3 0 4 2 0 2 3 0 2 5 5 4 3 0 2 0 5 4 5 4 0 5
output:
1 68
result:
wrong answer 2nd lines differ - expected: '33', found: '68'
Subtask #3:
score: 0
Skipped
Dependency #1:
0%