Task: | sume |
Sender: | Hansuzu |
Submission time: | 2016-08-02 15:11:58 +0300 |
Language: | C++ |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.06 s | details |
#4 | ACCEPTED | 0.06 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | ACCEPTED | 0.38 s | details |
#7 | ACCEPTED | 0.38 s | details |
Compiler report
input/code.cpp: In function 'long long int gs(int, int)': input/code.cpp:14:15: warning: unused variable 's' [-Wunused-variable] long long s=0; ^
Code
#include <iostream> using namespace std; int N; int S[1010][1010]; int A[1010]; long long gs(int a, int b){ if ((b-a)%2==1){ long long s=0; for (int i=a; i+1<=b; i+=2) s+=S[i][i+1]; return s; }else{ long long s=0; return (gs(a+1, b)+gs(a, b-1)+S[a][b])/2; } } int main(){ cin >> N; for (int i=0; i<N; ++i) for (int j=0; j<N; ++j) cin >> S[i][j]; if (N>2){ A[0]=gs(0, N-1)-gs(1, N-1); for (int i=1; i<N; ++i) A[i]=S[0][i]-A[0]; for (int i=0; i<N; ++i) cout << A[i] << " "; cout << "\n"; }else{ cout << 1 << " " << 1 << "\n"; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2
0 2 2 0 |
correct output |
---|
1 1 |
user output |
---|
1 1 |
Test 2
Verdict: ACCEPTED
input |
---|
4
0 3 6 7 3 0 5 6 6 5 0 9 7 6 9 0 |
correct output |
---|
2 1 4 5 |
user output |
---|
2 1 4 5 |
Test 3
Verdict: ACCEPTED
input |
---|
3
0 90003 90003 90003 0 6 90003 6 0 |
correct output |
---|
90000 3 3 |
user output |
---|
90000 3 3 |
Test 4
Verdict: ACCEPTED
input |
---|
8
0 30038 62527 40609 36422 6774... |
correct output |
---|
17977 12061 44550 22632 18445 ... |
user output |
---|
17977 12061 44550 22632 18445 ... |
Test 5
Verdict: ACCEPTED
input |
---|
30
0 54221 21576 54530 22345 5482... |
correct output |
---|
16412 37809 5164 38118 5933 38... |
user output |
---|
16412 37809 5164 38118 5933 38... |
Test 6
Verdict: ACCEPTED
input |
---|
1000
0 35894 61997 41654 61652 2980... |
correct output |
---|
17429 18465 44568 24225 44223 ... |
user output |
---|
17429 18465 44568 24225 44223 ... |
Test 7
Verdict: ACCEPTED
input |
---|
1000
0 70871 52683 64032 77345 5665... |
correct output |
---|
44202 26669 8481 19830 33143 1... |
user output |
---|
44202 26669 8481 19830 33143 1... |