QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#747256 | #5489. Room Evacuation | t-aswath | WA | 3ms | 3856kb | C++14 | 1.8kb | 2024-11-14 16:43:03 | 2024-11-14 16:43:03 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define deb(x...) 42
#endif
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define MOD 1000000007
ll n,m,t;
vector<string> a;
bool sol(int i,int j,int d,vector<string> &vis){
if(i<0||j<0||i>=n||j>=m||a[i][j]=='#'||d>t){
return false;
}
if(vis[i][j]=='V'){
return false;
}
if(a[i][j]=='E'){
return d<=t;;
}
vis[i][j]='V';
bool ans=false;
ans|=sol(i+1,j,d+1,vis);
ans|=sol(i-1,j,d+1,vis);
ans|=sol(i,j+1,d+1,vis);
ans|=sol(i,j-1,d+1,vis);
return ans;
}
void solve() {
cin>>n>>m>>t;
a.resize(n);
for(ll i=0;i<n;i++) {
cin>>a[i];
}
ll ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(a[i][j]=='P'){
vector<string>vis;
vis=a;
ans+=sol(i,j,0,vis);
}
}
}
cout<<ans<<endl;
}
int main() {
fast_io;
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("output.txt", "w", stderr);
#endif
ll t = 1;
// cin >> t;
for(ll i = 0; i < t; i++) {
#ifdef LOCAL
cout << "CASE " << i + 1 << ":\n";
#endif
solve();
}
#ifdef LOCAL
cout << endl << "Finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n\n";
#endif
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
input:
4 5 3 ..... ..P#. ..PPE ..P.E
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
3 3 5 ... P#P P#E
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
20 15 53 PPEP..PP#P.#P.# P.###EP#PEPP.E# .PEEPEEP#E#PPE# PE#.##P#..PP.## E.PPP.#E##EPE## E#P#.EEE.EEPPPP P.#PPPE.PPPP#.P .##EEEE.#E.E.## P..P#PEPPEE#.PP EPEEEEE#E.E.E#P ##.E.EPP.PEE.EP ..E#.PE.#EP.#PE EEEEPP.E.#.EEP. ..E#PPE.#EPEP.. EPP.#.PP#P#P#PE EE#.PP.#EP.PPE# EEPP####P#.#E.# PP.EEE..###PEP. #EP...
output:
89
result:
ok single line: '89'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
4 1 137 . # # #
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
14 15 200 ###EPP...#P.E#. #.##EE#E#.PP#EP E.PPP.E.#.##PPP #E.EP##..#.#.## #P###EEE#E#.E.# #P..EPPE.#..EE. PP#P#E.#PP#.PEE .PEPEE#E#..EE## EE.PP.PE#EE#PEE P.#EPP.P#.EPP#P E..#P#PEPE#EP.# E.PP.EEP.#.#... PP.P#P#PEEEPPEE #.EE.P.P.P#E#PP
output:
55
result:
ok single line: '55'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
9 13 200 .P.E.PEPP.EE. .##E.EEE.P##. P##P.#..EP.PE E#EE...PEEP.E E#....PPP#PPP .#EPE.PPEP#PE #EEP...##P... #.P##EE#.E#.# #EPEP.E...P#P
output:
28
result:
ok single line: '28'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
8 13 28 #PEPP..#E##EE EEEPPEPPE...E ..##PP#P#..#P P...PP.PPE#PE EPPEE.PEEPEPP #EPE#PE#####. P.P#.#E.E...P ###EP##.EP.PP
output:
32
result:
ok single line: '32'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
13 20 200 P.E#E.P.#EP#P..#.#E. ..E...P.E#EP#.PE.P#P ##E#E#.P##P#PP#E#.EE .P#..#PP.E#E#E#E#PPP #P.EEP..EPEPPEE..E#E PPE###...EEPP#.#E.P. PP.#.##E#E##.P#.EPEE EE#PEPE.#P#.PP..EP.. #.EPE#P.P#EEPPP.P##. ####E###PE#E###EPP## #.EP#.#..#.#E#..#EPE E#EEPE#PP..EPE#P#P.E .#PPE#E.#.#EP#PEE#EP
output:
62
result:
ok single line: '62'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
14 5 200 ..EEP P.EE# P.### ##.P# #E.EP ...EE ..#.. PEPEE ##.PP .P..P PP#.. E.#EP E..P. EE.E.
output:
15
result:
ok single line: '15'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
2 1 167 P P
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
6 20 199 .PE.E...P.EE...PE.## P.EPP.#EE#E.PP.P.#.E E#E#E#EEP.P.E##P.E## EEP#PPE#EE..##PPPP.# .PE#EP.PE#EE.P.E#EE# E#P.EEPP..P..EE#E#.P
output:
28
result:
ok single line: '28'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
7 14 200 #PE##..E#EPEP. ###PEPE.P##PPP #E.#P#PE###.PP .E#E.#EEE#PP.P P..EEEE#.E#P.. #.E.P.PEPEPP#. #E#EEPE.E##...
output:
24
result:
ok single line: '24'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
8 19 200 .#..#P#.P.P#.E.E..P #P.P##..P.PPE.EEP.E #.##P.#E.P##P....E. ##EPEE#.EPP.#.#EE.# #.#EPP#EE.PP#E#E.## PPPPE.EEP#EPEE..PPP #P###PPP#EP..E#P### #.##EPPE.#.PE#E.##P
output:
35
result:
ok single line: '35'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
6 15 200 ##.#P.E#.PE.P.E PEE...#E#EE..#P P.#.E#EP..#E... .EE#P#E.P.PEP#P P###.EE#P##.EEE .PE.E.P.PP.###.
output:
18
result:
ok single line: '18'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
2 12 200 #P.E.#...P#E E.##..#.P#..
output:
1
result:
ok single line: '1'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
12 1 108 # # E P # . P # E # # .
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
17 15 126 #.##.EEPEP#EE.E #P.#PPEP.P.#E#P .P##E.##E.E##PE P#EPPE.E#.#EPE# .EEEE.P#E.P...# P.PEPPEEEE.PE#. .#E..#...PPPPEP ##.EE.PE.PPPPE. P..P#PEP....P#E P.#...P...EPEE. #EE#.EPP#PEE.## .#.##.P#PEE###E #.#..#..EE.E#.P .#.#E.PPEEE...P PPPP##.E.PPEEPP EE.EE.EP.PEPPP. EP#P.P.P.#.P.P.
output:
67
result:
ok single line: '67'
Test #18:
score: -100
Wrong Answer
time: 3ms
memory: 3564kb
input:
20 20 200 PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPP...
output:
342
result:
wrong answer 1st lines differ - expected: '200', found: '342'