# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168891 | 2019-12-17T03:49:18 Z | abil | Experiments with Gorlum (IZhO13_expgorl) | C++14 | 1000 ms | 380 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mk make_pair #define all(s) s.begin(),s.end() //#define int long long using namespace std; const int N = (1e6 + 12); const int mod = (1e9 + 7); const int INF = (0x3f3f3f3f); int lx, ly; double dist(double x, double y){ return sqrt((x - lx) * (x - lx) + (y - ly) * (y - ly)); } main() { int k; string s; scanf("%d", &k); cin >> s; double gx, gy; cin >> lx >> ly; cin >> gx >> gy; double ansmin = dist(gx, gy), ansmax = dist(gx, gy); for(int i = 0;i < k; i++){ for(int j = 0;j < s.size(); j++){ if(s[j] == 'L'){ gx--; } else if(s[j] == 'R'){ gx++; } else if(s[j] == 'F'){ gy++; } else if(s[j] == 'B'){ gy--; } ansmin = min(ansmin, dist(gx, gy)); ansmax = max(ansmax, dist(gx, gy)); } } cout << fixed << setprecision(9) << ansmin << " " << ansmax; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 173 ms | 376 KB | Output is correct |
2 | Correct | 284 ms | 256 KB | Output is correct |
3 | Correct | 338 ms | 376 KB | Output is correct |
4 | Correct | 363 ms | 364 KB | Output is correct |
5 | Correct | 141 ms | 256 KB | Output is correct |
6 | Correct | 234 ms | 364 KB | Output is correct |
7 | Correct | 306 ms | 376 KB | Output is correct |
8 | Correct | 447 ms | 380 KB | Output is correct |
9 | Execution timed out | 1072 ms | 256 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |