Cod sursa(job #532595)

Utilizator impulseBagu Alexandru impulse Data 12 februarie 2011 00:01:41
Problema Xor Max Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.72 kb
#include<fstream>
using namespace std;
int v[10000][10000];
int n;

int main()
{
    ifstream in("xormax.in");
    in>>n;

    int now = 0;
    int start = 0, end = 0;
    int max = 0;

    for(int i = 0; i < n; i++)
    {
        in>>v[i][0];
        for(int c = i + 1; c < n - 1; c++)
        {
            v[i][c] ^= v[i][0];
        }
    }
    in.close();

    for(int i = 0; i < n; i++)
    {
        for(int c = i; c < n - 1; c++)
        {
            if(v[i][c] > max)
            {
                max = v[i][c];
                start = c;
                end = i;
            }
        }
    }
    ofstream out("xormax.out");
    out<<max<<" "<<start + 1 <<" "<<end + 1;
    out.close();
}