Submission #60958472
Source Code Expand
Copy
#include<iostream>using namespace std;int main(){int h,m,x,y;cin>>h>>m>>x>>y;x--;y--;string s[10010];for(int i=0;i<h;i++){cin>>s[i];}string step;cin>>step;int sum=0;for(int i=0;i<step.size();i++){//cout<<x<<" "<<y<<endl;if(step[i]=='U'){if(x-1<h&&s[x-1][y]!='#'){x--;if(s[x][y]=='@'){sum++;
#include<iostream> using namespace std; int main(){ int h,m,x,y; cin>>h>>m>>x>>y; x--; y--; string s[10010]; for(int i=0;i<h;i++){ cin>>s[i]; } string step; cin>>step; int sum=0; for(int i=0;i<step.size();i++){ //cout<<x<<" "<<y<<endl; if(step[i]=='U'){ if(x-1<h&&s[x-1][y]!='#'){ x--; if(s[x][y]=='@'){ sum++; s[x][y]='.'; } } }else if(step[i]=='D'){ if(x+1<h&&s[x+1][y]!='#'){ x++; if(s[x][y]=='@'){ sum++; s[x][y]='.'; } } }else if(step[i]=='L'){ if(y-1<m&&s[x][y-1]!='#'){ y--; if(s[x][y]=='@'){ sum++; s[x][y]='.'; } } }else if(step[i]=='R'){ if(y+1<m&&s[x][y+1]!='#'){ y++; if(s[x][y]=='@'){ sum++; s[x][y]='.'; } } } } cout<<x+1<<" "<<y+1<<" "<<sum; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Santa Claus 1 |
User | Xixishuiba |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 861 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3900 KB |
Compile Error
Main.cpp: In function ‘int main()’: Main.cpp:15:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 15 | for(int i=0;i<step.size();i++){ | ~^~~~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | hand_01.txt, hand_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 1 ms | 3800 KB |
hand_02.txt | AC | 1 ms | 3776 KB |
random_01.txt | AC | 1 ms | 3720 KB |
random_02.txt | AC | 1 ms | 3884 KB |
random_03.txt | AC | 1 ms | 3896 KB |
random_04.txt | AC | 1 ms | 3856 KB |
random_05.txt | AC | 1 ms | 3788 KB |
random_06.txt | AC | 1 ms | 3772 KB |
random_07.txt | AC | 1 ms | 3772 KB |
random_08.txt | AC | 1 ms | 3752 KB |
random_09.txt | AC | 1 ms | 3840 KB |
random_10.txt | AC | 1 ms | 3900 KB |
random_11.txt | AC | 1 ms | 3800 KB |
random_12.txt | AC | 1 ms | 3768 KB |
random_13.txt | AC | 1 ms | 3852 KB |
sample_01.txt | AC | 1 ms | 3772 KB |
sample_02.txt | AC | 1 ms | 3752 KB |
sample_03.txt | AC | 1 ms | 3816 KB |