QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#355206 | #2302. Knitpicking | ckiseki# | WA | 1ms | 4100kb | C++20 | 1.2kb | 2024-03-16 14:29:13 | 2024-03-16 14:29:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
void debug_(auto s, auto ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int f = 0;
(..., (cerr << (f++ ? ", " : "") << a));
cerr << ")\e[0m\n";
}
#include <experimental/iterator>
void orange_(auto s, auto L, auto R) {
cerr << "\e[1;33m[ " << s << " ] = [ ";
using namespace experimental;
copy(L, R, make_ostream_joiner(cerr, ", "));
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
int tot = 0;
map<pair<string, string>, int> a;
for (int i = 0; i < n; ++i) {
string s, o;
int x;
cin >> s >> o >> x;
a[{s, o}] += x;
tot += x;
}
map<string, int> b;
for (auto [k, v] : a) {
auto [s, o] = k;
if (o == "any")
v = min(v, 1);
b[s] = max(b[s], v);
}
int ans = 1;
for (auto [k, v] : b)
ans += v;
if (ans >= tot) {
cout << "impossible\n";
} else {
cout << ans << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3552kb
input:
1 a right 1
output:
impossible
result:
ok single line: 'impossible'
Test #2:
score: 0
Accepted
time: 1ms
memory: 4036kb
input:
1000 ehtxfswvjctflpymwvpu left 490 aoarodkjmvfxjzmuywws right 441 wbiwtrdrmtonomjlacny left 593 lxargqrkcbibrpgvbmtn left 451 xegwrtwznrhpziuduohf left 999 hfrbhoyemnooutcraxea right 323 etrytrwvzohcieikbuzj right 737 upzpwtidbyyyixrgcubf left 165 triwxccjjyggvyhetzjg left 956 emoedagctbncppybklmz l...
output:
484655
result:
ok single line: '484655'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
1000 fdfjrkigimhdklwpbjfq any 1 orplbnusrtnywcabovuz any 1 fcwqvjhmgxpqrgbnltuu right 456 qokzqcteopapcayzvojp right 601 xyawkinqjmntqlkeuaqp left 334 gwjngblhxjimeylrfchk right 839 etxefreizcivrcppreww any 1 xxkhaiwbafmujafffvdj right 924 japbjgqtamzwzavzvopw right 33 fvvdtprtiwjindtweztm any 1 gyg...
output:
impossible
result:
ok single line: 'impossible'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4100kb
input:
1000 sdmahapqooqcoblpaxmo left 745 vbnuuavqxbmrirmzjdwb right 555 wfnnnzoahqnechdacthx left 666 vshsbtdxehcnzfzfczeb any 1 dlhelxzpyswaidvxsgkz any 1 xzebrtcoidsxmacqdwwk right 831 skyalmvvwtbahyjmjgfr left 80 oizpvmqqohpkbtbfjtzs any 1 mouekxvcnodieywzzjyf left 7 kinkwztsuaedroqtqfvq right 226 imkp...
output:
impossible
result:
ok single line: 'impossible'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
1 abcdefghijklmnopqrst left 1
output:
impossible
result:
ok single line: 'impossible'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
1 uiop any 1
output:
impossible
result:
ok single line: 'impossible'
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3500kb
input:
1 jgekwa any 2
output:
impossible
result:
wrong answer 1st lines differ - expected: '2', found: 'impossible'