Submission #1141612
Source Code Expand
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<sstream> #include<cstdio> #include<cstdlib> #include<cstring> #include<climits> #include<cmath> #include<string> #include<vector> #include<set> #include<map> #include<queue> #include<numeric> #include<functional> #include<algorithm> #include<bitset> #include<tuple> #include<unordered_set> #include<random> #include<array> #include<cassert> using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) int h, w, k, sy, sx; string s[50]; int n; int fy[2500], fx[2500]; int f[2500], d[2500]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> h >> w >> k >> sy >> sx; rep(i, h)cin >> s[i]; cin >> n; rep(i,n) { cin >> fy[i] >> fx[i] >> f[i] >> d[i]; fy[i]--; fx[i]--; } sy--; sx--; string ans; int y, x; y = sy; x = sx; while (x - 1 >= 0 && s[y][x - 1] != '#') { x--; ans += 'L'; } if (y<h/2) { while (y + 1 < h) { int py = y, px = x; if (y + 1 < w && s[y+1][x] != '#') { ans += 'D'; y++; } while (x+1 < w && s[y][x+1]!='#') { x++; ans += 'R'; } if (y + 1 < w && s[y + 1][x] != '#') { ans += 'D'; y++; } while (x - 1 >= 0 && s[y][x - 1] != '#') { x--; ans += 'L'; } if (py == y&&px == x)break; if (ans.size() > 1000)break; } } else { while (y - 1 >= 0) { int py = y, px = x; if (y - 1 >= 0 && s[y - 1][x] != '#') { ans += 'U'; y--; } while (x + 1 < w && s[y][x + 1] != '#') { x++; ans += 'R'; } if (y - 1 >= 0 && s[y - 1][x] != '#') { ans += 'U'; y--; } while (x - 1 >= 0 && s[y][x - 1] != '#') { x--; ans += 'L'; } if (py == y&&px == x)break; if (ans.size() > 1000)break; } } ans.append(2500, '-'); cout << ans.substr(0, 2500) << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Food Collector |
User | hirokazu1020 |
Language | C++14 (GCC 5.4.1) |
Score | 3445 |
Code Size | 2006 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | test_01 | test_02 | test_03 | test_04 | test_05 | test_06 | test_07 | test_08 | test_09 | test_10 | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 3 / 20000 | 348 / 20000 | 413 / 20000 | 148 / 20000 | 781 / 20000 | 68 / 20000 | 229 / 20000 | 537 / 20000 | 222 / 20000 | 696 / 20000 | ||||||||||||||||||||
Status |
|
|
|
|
|
|
|
|
|
|
Set Name | Test Cases |
---|---|
test_01 | subtask_01_01.txt |
test_02 | subtask_01_02.txt |
test_03 | subtask_01_03.txt |
test_04 | subtask_01_04.txt |
test_05 | subtask_01_05.txt |
test_06 | subtask_01_06.txt |
test_07 | subtask_01_07.txt |
test_08 | subtask_01_08.txt |
test_09 | subtask_01_09.txt |
test_10 | subtask_01_10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask_01_01.txt | AC | 1 ms | 256 KB |
subtask_01_02.txt | AC | 1 ms | 256 KB |
subtask_01_03.txt | AC | 1 ms | 256 KB |
subtask_01_04.txt | AC | 1 ms | 256 KB |
subtask_01_05.txt | AC | 1 ms | 256 KB |
subtask_01_06.txt | AC | 1 ms | 256 KB |
subtask_01_07.txt | AC | 1 ms | 256 KB |
subtask_01_08.txt | AC | 1 ms | 256 KB |
subtask_01_09.txt | AC | 1 ms | 256 KB |
subtask_01_10.txt | AC | 1 ms | 256 KB |