QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#849877#3609. Reconstruct SumLaVuna47#AC ✓1ms3900kbC++201.6kb2025-01-09 18:53:462025-01-09 18:53:48

Judging History

你现在查看的是最新测评结果

  • [2025-01-09 18:53:48]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3900kb
  • [2025-01-09 18:53:46]
  • 提交

answer

/** gnu specific **/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/** contains everything I need in std **/
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(S) ((int)S.size())
#define FOR(i, st_, n) for(int i = st_; i < n; ++i)
#define RFOR(i, n, end_) for(int i = (n)-1; i >= end_; --i)
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef unsigned long long ull;
typedef long double LD;
typedef pair<ull, ull> pull;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
using namespace std;
#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif


int solve()
{
	int n;
	if(!(cin>>n))return 1;
	vector<int> a(n);
	FOR(i,0,n) cin>>a[i];
	int s=accumulate(all(a),0);
	int num=1e9+47;
	FOR(i,0,n)
	{
		if(s-a[i]==a[i])
		{
			num=a[i];
		}
	}
	if(num==1e9+47)cout<<"BAD\n";
	else cout<<num<<'\n';
    return 0;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int TET = 1e9;
    //cin >> TET;
    for (int i = 1; i <= TET; i++)
    {
        if (solve())
        {
            break;
        }
#ifdef ONPC
        cout << "__________________________" << endl;
#endif
    }
#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3576kb

input:

4
1
6
3
2

output:

6

result:

ok good solution

Test #2:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

4
-2
0
5
-3

output:

0

result:

ok good solution

Test #3:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

5
1
10
4
2
-3

output:

BAD

result:

ok No Solution

Test #4:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

6793
150
238
4
4
1
-63
880
-40
-3
28420
-21
-3894
-93
126
6
-3
8
-68
-14
1
7948
2116
1
-161
2
64
-10
13
-32
2
-30
1
-89
-5
17
-5
18
10
4732
3
162
-59
-2
-47
-1
21
2
49
-1
3
4
5
-2
-5
-4
-2
1
-1
21
-2
1
-1104
1
5
-3
42
106
2565
-5
14
17
797
365
294
-3
-981
2
-3
18
4
2
-1
-4075
-558
-30
-1
-25
17
11
4...

output:

-87262

result:

ok good solution

Test #5:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

8716
-1
38
-4
1
30
1
-4
-20
-1369
3
4
1157
-1
1
1
1
13
15057
-3
6
-17
2
-1
-4
-514
-33
5
-1
18
-24
-653
109
7
-3
22
2
-8636
349
-3
3
520
-2
1
-761
1
-2805
-1
-4
7008
108
-122
-25
-7088
-1
5972
1
-2
7
-2
2
-10
1
464
1
-12
-2
-38
-7
27
-1
-7306
-18
-2167
1
-1
-2
-14
-1
-3590
-7
16
-4
1
3313
-36
-13
-1...

output:

BAD

result:

ok No Solution

Test #6:

score: 0
Accepted
time: 1ms
memory: 3580kb

input:

1704
-3
16
-2
-80
5
-1
4
-12
11
1
-1
-3
-796
-6
7
8271
232
7
14
933
3
-4530
-517
9
-1670
-43
-7
124
-1
681
45
-3
181
-4
16
-93
1
3052
18
-1
25
-85
-1
1
-144
12
-3727
-6662
-8
1
-7
6
18310
5
-3
-3
-2575
1
3650
-2269
4
136
1
-635
52
-3
-7
8
-78
8
-3
1
235
-2
-9
1
215
3
259
-1
-2
-1149
4
-12
29344
-58
...

output:

-35125

result:

ok good solution

Test #7:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

6618
-17
-1
-1
28
-37
3082
-1
2
-16
-5
2294
1
-11
34
-1028
1
-5
-34
9721
2
-1
-2
-1
-1
-84
8150
1
204
-1
22
5
1
-23
1
-10
23606
-461
2
-38
163
-1
-6
5
-7167
-6
-4
227
2
4
-5
-4
-6
-8
-13
3
-1
139
-2
1
4
3
-2207
1
1
66
3
456
-9
3
2364
2
-1
18
-8
-2
-1698
-1195
-7
60
1
-1
-5
3
-3
-388
5
-1106
-8
-3
-2...

output:

19269

result:

ok good solution

Test #8:

score: 0
Accepted
time: 1ms
memory: 3884kb

input:

4039
1
26
57
142
-4
1
29821
73
218
1387
-2
121
-26
1
1
-11
1
-41
8
2
1
4
159
-4
-1859
1
22
-44
-5
554
54
-1
2
-3
-15503
1697
1
523
-28
-2156
5
-126
4
1
25
-3162
-4
-1
-3
56
-35
7
-1
-1
-7
-40
54
-18
-1
-510
-55
6702
128
-1
-1730
-11
1
-363
1
-1
-45
-4
-10
-4
-1
-6
-104
2
-17
1
-349
-5
-5
-1
1
-2
69
...

output:

-66284

result:

ok good solution

Test #9:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

5657
2
18448
-5
-1
15
11
-1
-358
10
13
10
-1
-2920
68
16
1
5
33
2779
-7073
2
-5
-1
6
4
-1
-1
948
-9
2
1
2
1
-1
50
-2
-35
-1
-23
54
23
26
448
8
-5
-4
-18
1
-1
-58
35
-6
231
3
-3
-2
359
3046
1
939
2297
2
1
330
-151
5
-1
-1
95
-582
-3
-330
-29922
1
4061
18
15120
17
-5
-94
-4
-2
-1
49
-38
-14629
1
-6
18...

output:

18100

result:

ok good solution

Test #10:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

2828
-1
522
1
-3
-2
-1343
248
-84
-2
1
27
1
125
343
28
1
-2
-3
-1
-9
1143
-1
-351
-1
-7
-1
11
6
-133
2
-6
37
-22
11
-2
-5
16
-1
-95
1
-1
-1
12
2
-2
-2
-129
-2
3
8
9
-6
-20
762
-3
13
-1
-4
-1
-240
2256
51
-1
-10
-12
123
883
1
-10
5
81
3
-208
-1
-1
3
77
-34
-2
1027
-15
7
-1
-1
1
16
-1
4
1
-1
-235
-22
...

output:

-2665

result:

ok good solution

Test #11:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

2917
-28
206
534
1
-4
17
1
1
1
2
-4
2
435
11
-2
15514
-5
-1
-2
224
667
66
-31
-9
-1
22
1
-2
3
-3
6
1
2
-15
-230
4
38
-1482
1
17
-1
27
-4
167
-2
-10
89
3482
17
-1272
-22
102
1
-18
1
2
-4557
-24
-51
268
84
4
1
3
-6
28447
-14
-38
-1
-1
-111
-1095
-1
-4
3
-5
-64
-18
-3
-1
-2
5
30076
150
-5
124
-1
-20
12...

output:

BAD

result:

ok No Solution

Test #12:

score: 0
Accepted
time: 1ms
memory: 3900kb

input:

7405
-1
-43
2
327
-6
7
1
-3
1
-345
4
1
-2
-2
12
-38
-1
45063
31
-29
-2
-1
3
-1
1
-57
4
-25
-427
-1
3
197
1
176
1
9
-142
-429
8746
-10
5
-5
-24
-56
-22
11
-1
1
2
742
3
6
-956
3
-795
3
1479
-59
-4
-4
19
365
1
885
1
7
-1
1
-4
-315
-7
-4
1
51
4
-2
1
1
2
1
-11
-4
-12
-51
241
-210
-245
-16
-3
154
-1
-3
13...

output:

BAD

result:

ok No Solution

Test #13:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

5576
1905
1
-12
70
-2
75
2
-1929
-351
170
-1
-1
-556
-1934
-10
-4
-10
34
-7024
-127
-612
-2
-3
-4
503
-1
-115
-1176
-2
1
-2
517
-10780
11
13
-1261
-6
49
1
-17
-1
-7
-202
1
-19
-14
1
35
212
-1
-44
-62
-1
-19
65
-5
-1
-4
-8
15
89
1
18
-4266
1
-8
-1
3
7
4
3
-1
2
72
-54
10
-1987
143
80
3
220
1
-71
-9
70...

output:

BAD

result:

ok No Solution

Test #14:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

2686
66
-4
35
25
-1
5
-1
-3
1
237
6
1
-1
-5
-710
7
-2234
-1
-24
-358
-60
-36
46
-2932
284
23
-92
-4
6
-265
9
-2
-22633
1
-5
-5
-19
24
7
24
1
-1
6
-1
12
-1
8142
-1
3
2
2581
738
5
3
-4
16
5
-4
-1839
-9
21
-4
95
3
-2
-171
1
7
1
-18
1
-144
4
-3609
6
1
-1097
6
130
12248
-9
-3768
8577
193
-10
6
7
13
84
23...

output:

-608

result:

ok good solution

Test #15:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

3
2
0
-1

output:

BAD

result:

ok No Solution