QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#49590#2283. Decelerating JumpasdasdasfasdfasdfsdafWA 2ms3616kbC++111.1kb2022-09-22 07:35:372022-09-22 07:35:38

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-22 07:35:38]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3616kb
  • [2022-09-22 07:35:37]
  • 提交

answer

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstring>
#include <functional>
#include <algorithm>
#include <bitset>
#include <numeric>

#define sk(i, x) for(uint64_t i = 0; i < x; i++) 
#define skc(i, start, x) for(uint64_t i = start; i < x; i++) 

#define chin(x) char x; std::cin >> x;
#define slin(x) int64_t x; std::cin >> x
#define lin(x) uint64_t x; std::cin >> x
#define qsort(x) std::sort(x.begin(), x.end())
#define qmaxv(x) *std::max_element(x.begin(), x.end());
#define vsum(x) std::accumulate( x.begin(), x.end(), 0 )

typedef std::vector<int64_t> slv;
typedef std::vector<uint64_t> uslv;
typedef std::vector<int32_t> siv;
typedef std::vector<uint32_t> uiv;
typedef std::vector<bool> bv;




int main()
{
	lin( n );
	slv squares( n );
	sk( i, n )
	{
		slin( a );
		squares[i] = a;
	}
	int64_t highest_score = -99999999999999;
	skc( start_pos, 1, n )
	{
		int64_t score = squares[0] + squares[n-1];
		skc( i, start_pos, n-1 )
		{
			score += squares[i];
		}
		if( score > highest_score ) {
			highest_score = score;
		}
	}
	std::cout << highest_score << "\n";
	return 0;

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3592kb

input:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

3

result:

ok single line: '3'

Test #3:

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

input:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

7

result:

ok single line: '7'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

12

result:

ok single line: '12'

Test #5:

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

input:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

27

result:

ok single line: '27'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0...

output:

35

result:

ok single line: '35'

Test #7:

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

input:

2
0 0

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3588kb

input:

2
-1 -9

output:

-10

result:

ok single line: '-10'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

10
-1 0 1 0 0 0 1 1 1 -1

output:

2

result:

ok single line: '2'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

20
-2 -2 -1 -1 -2 1 0 1 2 3 -1 2 1 3 2 3 -1 -2 -1 3

output:

14

result:

ok single line: '14'

Test #11:

score: -100
Wrong Answer
time: 2ms
memory: 3604kb

input:

10
3 10 -2 -9 4 -7 5 -7 -4 -5

output:

-2

result:

wrong answer 1st lines differ - expected: '3', found: '-2'