Task: | Pallo |
Sender: | xenial |
Submission time: | 2022-01-22 16:25:20 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#2 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'void set_io(std::__cxx11::string)': input/code.cpp:19:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen((filename + ".in").c_str(), "r", stdin); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ input/code.cpp:20:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result] freopen((filename + ".out").c_str(), "w", stdout); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define all(x) (x).begin(), (x).end()#define pb push_back#define fi first#define se second#define sz size#define rsz resize#define ii pair<int,int>#define vi vector<int>#define vvi vector<vector<int>>void set_io(string filename = "") {ios::sync_with_stdio(0);cin.tie(0);if (filename != "") {freopen((filename + ".in").c_str(), "r", stdin);freopen((filename + ".out").c_str(), "w", stdout);}}int dx[] {1, 1, -1, -1}, dy[] {1, -1, -1, 1};int main() {set_io("");int t; cin >> t;while (t--) {int h, w, k; cin >> h >> w >> k;ll bounces = 0;int x = 1, y = 1, dir = 0;while (k--) {if (x == 0 || x == w - 1 || y == 0 || y == h - 1) {if ((x == 0 || x == w - 1) && (y == 0 || y == h - 1)) {dir += 2;dir %= 4;} else if ((dir == 0 && x == w - 1) || (dir == 1 && y == 0) ||(dir == 2 && x == 0) || (dir == 3 && y == w - 1)) {dir += 3;dir %= 4;} else {dir++;dir %= 4;}bounces++;}x += dx[dir];y += dy[dir];}cout << bounces << endl;}}
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
100 10 5 76 9 8 78 8 6 49 3 3 94 ... |
correct output |
---|
25 19 15 47 8 ... |
user output |
---|
18 12 11 47 6 ... Truncated |
Test 2
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 7 5 99033171167123849 6 8 472883555390027162 9 10 258937093512465880 10 6 691774305483997493 ... |
correct output |
---|
33011057055707949 148620545979722822 57541576336103529 199845910473154830 52151060432923288 ... |
user output |
---|
(empty) |
Test 3
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000 816332614 86098803 33572721929... |
correct output |
---|
4310587870 45982113074 1550250683 717639357 3282221941 ... |
user output |
---|
(empty) |