QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#731305 | #5595. Hunt the Wumpus | beamishboys# | WA | 0ms | 3596kb | C++23 | 867b | 2024-11-10 01:58:09 | 2024-11-10 01:58:09 |
Judging History
answer
#include <iostream>
#include <vector>
#include <set>
using namespace std;
using ll = long long;
signed main() {
ll s;
cin >> s;
set<pair<ll, ll>> positions;
for (int i = 0; i < 4; i++) {
s = s + s/13 + 15;
positions.insert({s % 10, (s/10) % 10});
}
ll hits = 0, moves = 0;
ll guess, x, y;
while (hits < 4) {
cin >> guess;
moves++;
x = guess % 10;
y = (guess / 10) % 10;
for (pair<ll, ll> p : positions) {
if (abs(x - p.first) + abs(y - p.second) == 0) {
positions.erase(p);
hits++;
cout << "You hit a wumpus!\n";
break;
}
}
if (positions.size() == 0) break;
ll dist = 1000;
for (pair<ll, ll> p : positions) {
dist = min(dist, abs(p.first - x) + abs(p.second - y));
}
cout << dist << "\n";
}
cout << "Your score is " << moves << " moves.\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
203811 00 01 02 03
output:
You hit a wumpus! 1 You hit a wumpus! 1 You hit a wumpus! 1 You hit a wumpus! Your score is 4 moves.
result:
ok 8 lines
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3544kb
input:
101628 00 40 60 68 78 95
output:
6 2 You hit a wumpus! 8 1 You hit a wumpus! 5 You hit a wumpus! Your score is 6 moves.
result:
wrong answer 1st lines differ - expected: '4', found: '6'