QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#227188 | #7533. Jeopardized Betting | Piashy# | WA | 1ms | 3800kb | C++20 | 3.3kb | 2023-10-27 01:12:08 | 2023-10-27 01:12:08 |
Judging History
answer
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define sz(a) (int) a.size()
const int inf = (int)1e9;
const ll linf = (ll)2e18;
const ll mod = (ll)1e9 + 7ll;
void solve() {
/*string s; int n; cin >> s;
n = sz(s);
int curr_div = 0;
//vector <vector<string>> res(n, {""});
//res[0][0] = "9";
bool is_pos = true;int curr_ind = 0;
vector<vector<int>> res(n / 2);
res[0].push_back(9);
vector <pair<int, vector<int>>> counts_and_indexes(n / 2 + 1, make_pair(0, vector<int>(0)));
for (int i = 1; i < n; i+=2) {
res[curr_ind].push_back((int)(s[i]));
if (is_pos) {
if (s[i] == '*') {
res[curr_ind].push_back(9);
}
else if (s[i] == '/') {
res[curr_ind].push_back(1);
}
else {
curr_ind++;
is_pos = (s[i] == '+');
if (is_pos) {
res[curr_ind].push_back(9);
}
else {
res[curr_ind].push_back(1);
}
}
}
else {
if (s[i] == '*') {
res[curr_ind].push_back(1);
}
else if (s[i] == '/') {
curr_div++;
res[curr_ind].push_back(0);
}
else {
counts_and_indexes[curr_div].first++;
counts_and_indexes[curr_div].second.push_back(curr_ind);
curr_ind++;
curr_div = 0;
is_pos == (s[i] == '+');
}
}
}
int max_div = n / 2;
while (max_div > 0 && counts_and_indexes[max_div].first == 0)
max_div--;
for (int i = max_div; i > 0; i--) {
while (counts_and_indexes[i].first >= 9) {
counts_and_indexes[i].first -= 9;
for (int j = 0; j < 9; j++) {
int ind = counts_and_indexes[i].second.back();
}
counts_and_indexes[i].
}
}*/
int n; cin >> n;
ll st = 1 << (2*n);
vector<vector<pair<ll, ll>>> dp(n, vector<pair<ll, ll>>(n));
dp[n - 1][n - 1] = { st, st };
for (int i = n - 2; i >= 0; --i) {
dp[i][n - 1] = { dp[i + 1][n - 1].first / 2, dp[i + 1][n - 1].first / 2 };
}
for (int i = n - 2; i >= 0; --i) {
dp[n - 1][i] = { st + dp[n - 1][i + 1].first / 2, st - dp[n - 1][i + 1].first / 2 };
}
for (int i = n - 2; i >= 0; --i) {
for (int j = n - 2; j >= 0; --j) {
dp[i][j] = { (dp[i + 1][j].first + dp[i][j + 1].first) / 2, (dp[i + 1][j].first - dp[i][j + 1].first) / 2 };
}
}
int w = 0;
int l = 0;
string s;
while (w < n && l < n) {
cout << dp[w][l].second << endl;
cin >> s;
if (s == "Lost") {
++l;
}
else {
++w;
}
}
}
signed main() {
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//freopen("test.in", "r", stdin);
//freopen("test.in", "w", stdout);
//cout << fixed << setprecision(7);
//clock_t start = clock();
int tet = 1;
//cin >> tet;
while (tet--) {
solve();
}
//clock_t end = clock();
//ld seconds = (ld)(end - start) / CLOCKS_PER_SEC;
//cout << seconds << "\n";
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3560kb
input:
3 Lost Won Won Won
output:
24 24 32 32
result:
ok Ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
4 Won Lost Won Lost Won Lost Won
output:
80 80 96 96 128 128 256
result:
ok Ok
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3800kb
input:
30 Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost
output:
28002324 28002324 27511055 26528517 25081507 23223618 21032711 18605859 16052114 13483775 11007164 8714004 6674556 4933368 3508173 2391936 1557540 964191 564404 310422 159191 75406 32608 12681 4347 1279 310 58 7 0
result:
wrong answer Integer 0 violates the range [1, 1152921504338411527]