245D - Restoring Table - CodeForces Solution


constructive algorithms greedy *1500

Please click on ads to support us..

C++ Code:

#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n; 
    cin>>n;
    int a[n][n], b[n];
    for (int i = 0; i < n; i++)
        {
            b[i]=0;
            for (int j = 0; j < n; j++)
                cin>>a[i][j];
        }
    for (int i = 0; i < n; i++) {
        for(int j=0; j<n; j++)
        if(i!=j)
        b[i]|=a[i][j];
    }
    for (int i = 0; i < n; i++) 
        cout<<b[i]<<" ";
        cout<<endl;
}


Comments

Submit
0 Comments
More Questions

1625C - Road Optimization
1715D - 2+ doors
267A - Subtractions
1582A - Luntik and Concerts
560A - Currency System in Geraldion
946A - Partition
1068B - LCM
1692E - Binary Deque
679A - Bear and Prime 100
488A - Giga Tower
14A - Letter
1150A - Stock Arbitraging
1552A - Subsequence Permutation
1131F - Asya And Kittens
1475F - Unusual Matrix
133B - Unary
1547A - Shortest Path with Obstacle
624A - Save Luke
1238A - Prime Subtraction
1107C - Brutality
1391B - Fix You
988B - Substrings Sort
312A - Whose sentence is it
513A - Game
1711E - XOR Triangle
688A - Opponents
20C - Dijkstra
1627D - Not Adding
893B - Beautiful Divisors
864B - Polycarp and Letters