CSES - Leirikisa 5 - Results
Submission details
Task:sume
Sender:zxc
Submission time:2016-08-02 15:17:29 +0300
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2ACCEPTED0.05 sdetails
#3ACCEPTED0.06 sdetails
#4ACCEPTED0.05 sdetails
#5ACCEPTED0.06 sdetails
#6ACCEPTED0.38 sdetails
#7ACCEPTED0.37 sdetails

Code

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int t[1111][1111];;
int main() {
    int n;
    cin>>n;
    ll totSum = 0;
    for(int i = 0; i < n; ++i) {
	for(int j = 0; j < n; ++j) {
	    cin>>t[i][j];
	    totSum += t[i][j];
	}
    }
    ll c = 0;
    for(int i = 0; i < n; ++i) {
	c += t[0][i];
    }
    totSum /= (n-1)*2;
    if(n == 2) {
	cout<<1<<' '<<1<<'\n';
	return 0;
    }
    ll a1 = (-totSum+c)/(n-2);
    cout<<a1<<' ';
    for(int i = 1; i < n; ++i) {
	cout<<t[0][i]-a1<<' ';
    }
    cout<<'\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...