QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#261988 | #7747. Memory | ckiseki# | AC ✓ | 10ms | 3952kb | C++20 | 1.2kb | 2023-11-23 14:28:42 | 2023-11-23 14:28:42 |
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 orange(...) safe
#define debug(...) safe
#endif
int main() {
cin.tie(nullptr) -> sync_with_stdio(false);
int n;
cin >> n;
vector<int64_t> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
bool flag = false;
for (int i = 0; i < n; i++) {
if (a[i] > 0) {
cout << '+';
} else if (a[i] < 0) {
cout << '-';
} else if (a[i] == 0) {
if (flag) {
cout << '+';
} else {
cout << '0';
}
}
if (a[i] % 2 != 0) {
a[i] -= 1;
flag = true;
}
if (i + 1 < n) a[i + 1] += a[i] / 2;
}
cout << '\n';
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
10 2 -1 4 -7 4 -8 3 -6 4 -7
output:
+0+-+---+-
result:
ok single line: '+0+-+---+-'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
10 -1 36 18 18 18 18 18 18 18 -18
output:
-++++++++-
result:
ok single line: '-++++++++-'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1000 -1 193552 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 96776 967...
output:
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
result:
ok single line: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-'
Test #4:
score: 0
Accepted
time: 8ms
memory: 3952kb
input:
100000 -1 696082628 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 348041314 ...
output:
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
result:
ok single line: '-+++++++++++++++++++++++++++++...++++++++++++++++++++++++++++++-'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
10 -1 70 -35 -72 36 12 -6 42 -21 -84
output:
-+---+-+--
result:
ok single line: '-+---+-+--'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
1000 -1 -120742 60371 -567374 283687 -507718 253859 -579246 289623 21402 -10701 539474 -269737 -681332 340666 -746052 373026 -993382 496691 -333880 166940 -632724 316362 909690 -454845 86680 -43340 236688 -118344 -29102 14551 6252 -3126 -440612 220306 -878460 439230 649538 -324769 -651632 325816 882...
output:
---------+-+-----------+-+-+---+-----+---+-+-+---+-+-+-+-+---+-----+-----+---+-+-----+-----+-+-+---+---+-+-----+-------+-+---+-----+-+-+-------+-+-+-+-+-------+-----+-+-+-------+-------+-+-+-------+---+-+---+-+---+-+-+-+---+-+-+-+-+---------+-----+-----+-+-+-+-+-+-+-+---+-+-+-------+---+-+-+-+-+-+--...
result:
ok single line: '---------+-+-----------+-+-+--...+---+-+-+-+-+-----+-+---------+'
Test #7:
score: 0
Accepted
time: 9ms
memory: 3936kb
input:
100000 -1 126247070 -63123535 -440273040 220136520 809537358 -404768679 -927404550 463702275 896759686 -448379843 155450002 -77725001 995415070 -497707535 -730811632 365405816 -223816910 111908455 255855870 -127927935 -78358522 39179261 190117110 -95058555 -61118274 30559137 243732804 -121866402 -48...
output:
-+---+---+-+-+-----+---+---+-------+-+-+---+-----+---+-+-+-----+-+-----+-----+-+---+-+---+---+-+-+-+-+-----------+---+-+-+-------+-+-+---+-----+-------+-+---+-+---------------+-----------------+-+-----+-+-+---+-+-+-+---+-+-----+-+-+---+-+-----+-+-+-----+-----+-+-+-----+-+-+-----+-+---+-+---+-+-+-+--...
result:
ok single line: '-+---+---+-+-+-----+---+---+--...--+-+-+---+---+---+---+-+------'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
10 0 2 -1 88 -44 14 -7 -32 16 32
output:
0+0+0+0-0+
result:
ok single line: '0+0+0+0-0+'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1000 0 804678 -402339 501804 -250902 701336 -350668 341920 -170960 234558 -117279 138082 -69041 383094 -191547 613608 -306804 -173632 86816 105660 -52830 268340 -134170 -786944 393472 -702908 351454 236550 -118275 83428 -41714 280776 -140388 -743190 371595 -762656 381328 -873564 436782 565326 -28266...
output:
0+0+0+0+0+0+0+0+0-0+0+0-0-0+0+0+0-0-0-0+0+0-0-0+0+0-0+0-0+0-0+0-0-0-0+0+0+0-0+0+0-0-0+0+0+0-0+0-0-0+0-0-0-0-0-0+0-0+0-0-0-0+0-0+0-0+0+0-0+0-0+0-0+0-0-0+0+0-0+0-0+0-0+0-0+0+0+0-0+0-0-0-0+0+0-0+0+0+0+0+0-0+0-0+0-0+0+0-0-0-0+0+0+0+0-0+0-0-0+0+0-0-0+0+0+0-0+0+0-0+0-0+0+0-0+0-0+0+0+0-0+0-0-0-0-0-0+0-0+0+...
result:
ok single line: '0+0+0+0+0+0+0+0+0-0+0+0-0-0+0+...-0-0+0+0+0-0-0-0-0-0+0-0+0-0+0+'
Test #10:
score: 0
Accepted
time: 9ms
memory: 3876kb
input:
100000 0 281054714 -140527357 181299510 -90649755 -155852956 77926478 804466996 -402233498 100794828 -50397414 -498194394 249097197 674196350 -337098175 947822240 -473911120 649015454 -324507727 -445192880 222596440 517778906 -258889453 580158794 -290079397 -634780702 317390351 -689237014 344618507 ...
output:
0+0+0-0+0+0-0+0+0+0-0+0+0-0-0-0+0-0-0+0+0-0-0+0+0+0+0+0-0+0+0-0-0-0+0+0+0-0+0+0-0-0-0-0-0-0+0+0-0-0+0+0-0+0+0+0+0-0+0-0-0+0+0-0+0-0-0+0+0-0+0+0+0-0+0+0+0-0+0-0-0+0-0-0-0-0-0-0+0-0-0-0+0-0-0+0+0+0+0-0-0+0-0+0-0+0+0-0+0-0+0-0+0+0+0-0-0+0-0+0-0+0+0-0+0+0+0+0+0+0+0-0+0-0+0+0+0-0-0-0+0-0+0-0-0+0-0-0-0-0-...
result:
ok single line: '0+0+0-0+0+0-0+0+0+0-0+0+0-0-0-...-0-0-0+0+0-0+0+0+0+0+0-0-0-0+0-'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
10 1 96 -48 -50 25 38 -19 -16 8 64
output:
+++-+++-++
result:
ok single line: '+++-+++-++'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1000 1 -233282 116641 245142 -122571 -866732 433366 342040 -171020 -114326 57163 -723670 361835 559940 -279970 47632 -23816 -546562 273281 -677060 338530 189622 -94811 206166 -103083 -354146 177073 -503094 251547 671860 -335930 -810126 405063 -743936 371968 -799120 399560 579380 -289690 -829990 4149...
output:
+-+++-+++-+-+++++-+-+++++-+-+++-+-+-+++-+++-+++++++++++++++-+-+-+++++++++++++++++-+-+-+++++-+-+-+++++++++++++-+++++-+-+-+-+++++-+-+-+++-+++-+-+-+++++-+-+-+++-+++-+++++++-+-+++-+++-+-+-+++-+++-+-+-+++-+-+-+++-+++++-+-+++-+-+-+++++++++++++-+-+-+++-+++-+++++-+++++++++-+-+++++-+++-+-+++-+-+-+-+-+-+-+-+-...
result:
ok single line: '+-+++-+++-+-+++++-+-+++++-+-++...++-+++++-+++++-+-+++++-+-+++++-'
Test #13:
score: 0
Accepted
time: 9ms
memory: 3884kb
input:
100000 1 -836242278 418121139 779823668 -389911834 456274226 -228137113 -468926922 234463461 -674503678 337251839 -167236416 83618208 217124940 -108562470 83590374 -41795187 888634130 -444317065 -477073058 238536529 -539286006 269643003 593019232 -296509616 983037312 -491518656 -730801390 365400695 ...
output:
+-+++++-+-+-+++++++-+-+++++-+++-+++++++-+++-+++++++++-+++++++-+-+-+++++++++++-+-+-+-+-+-+++-+-+-+-+++-+++-+++-+++++++++++++++++++-+++-+-+-+-+++++++-+++-+-+-+++-+++-+++++++-+-+++++-+-+++-+-+++++-+-+++-+-+++-+-+++++++-+++++++++-+-+++-+++++++-+-+++++++-+-+-+++-+++-+-+++-+-+-+-+++-+-+-+-+-+-+++-+++++++-...
result:
ok single line: '+-+++++-+-+-+++++++-+-+++++-++...++-+++++-+-+-+++++++-+-+-+++++-'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
10 1 -92 -46 -46 -46 -46 -46 -46 -46 46
output:
+--------+
result:
ok single line: '+--------+'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
1000 1 -236388 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -118194 -1181...
output:
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...
result:
ok single line: '+-----------------------------...------------------------------+'
Test #16:
score: 0
Accepted
time: 4ms
memory: 3900kb
input:
100000 1 -341428024 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -170714012 -1707...
output:
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------...
result:
ok single line: '+-----------------------------...------------------------------+'
Test #17:
score: 0
Accepted
time: 10ms
memory: 3832kb
input:
100000 -480901673 -509307600 -562561206 -720747466 941874932 -338344843 -453928087 355126643 -42193930 344068464 -358448536 132560523 166795837 314061531 487526745 -156787355 611354631 116338982 -466559641 -310495789 -368174169 729138 -202574892 -453653662 -893218259 827601754 128423870 -106094115 7...
output:
----+--+++-+++++++-------+++++---++-+----++++----++++----+++++++++------++-----+++++++++--++++-++++----+-+-++----+++--+-+++--------+-++-++++-------+++++-------------+-++---+-----++--+----+------+-+-++++-+++++-+--+++---+----++++---+++----+-+-+-------++-+-+-----++-++++++-+--++-+-+++-+-++++++--++-----+...
result:
ok single line: '----+--+++-+++++++-------+++++...--++-++-+---+-++---++-++++-++++'
Test #18:
score: 0
Accepted
time: 10ms
memory: 3888kb
input:
100000 401801336 -153873233 -245401319 57736118 -371480661 -7386866 -962876999 -509105223 -97542547 312188284 -825578860 197298463 -215386150 -894478467 184851706 -973780424 -155743919 405442471 -448475678 509920273 119901780 330459500 -494037860 -200311269 791000901 -661046994 634125416 890073378 -...
output:
++-------+-------+-+++--+-++-++++++----------+-+------+--++-++++++++-+++++--++++--+-+++---++-+--++++-++---+--+----+++-+----++++-----+---++-----++-----++++++-++--+-----+++-----++++-++-+-------+-+++-+----+-++--+---+-----++++--++-++++-+++++++++--------------+-+++++++++++-++-+-----++--+--+++++-------+++...
result:
ok single line: '++-------+-------+-+++--+-++-+...+++--+--++++++----+----++++----'
Test #19:
score: 0
Accepted
time: 9ms
memory: 3816kb
input:
100000 -125561068 496528427 123636069 784342199 315163748 28603817 875018886 626662912 680133215 575275399 412323523 210158900 -892535431 -641075550 715201047 209226508 539100445 -138478419 -725359009 -374696372 902945022 417100071 -542411037 347998418 232130268 -392785534 -565205746 -460603926 -584...
output:
-+++++++++++--++++--++-++------++-+-----+-----+----+-+++-----++---+++-++++++++------------+++------+++++--+++-+++--++++-+++-+--------++-------++++-+--------++--+-++--+-+---+-+--+++++-+--+-----+-++-+++++-++++++++++-+-++--+++---++++-----++++++-+-+-+++-++++++--+++++--+--+-+++----------+--+--++++++-----...
result:
ok single line: '-+++++++++++--++++--++-++-----...+++++++++------++---+-+--------'
Test #20:
score: 0
Accepted
time: 6ms
memory: 3892kb
input:
100000 757141941 851962794 440795956 -194084426 -460134759 116472002 366069975 -237568954 -785280815 838362513 -644741390 274896840 725282583 150384453 412526008 -902733855 -227998106 -144342224 -707275045 983776776 -557101528 503740642 -833874006 601340812 -378617867 -714458662 -59504201 483686065 ...
output:
++++--+--+-++++----+-+-+---+----++-+-++++-+++++++++-++--+-+++++-++--++-----++-----+++++-+++++----++-+--+++--++++-++++-+------++-++------+++-+----------++++++++-+++++--+------++-++--+++--++-+-+-++++--++++++++-+-+-----+-----++---+-+-+++++++-+--+--++-++-++--+-++++---+--+--++-+++++----+++---+++---++--++...
result:
ok single line: '++++--+--+-++++----+-+-+---+--...---+++++++-++------------+----+'
Extra Test:
score: 0
Extra Test Passed