Cod sursa(job #2161819)
Utilizator | Data | 11 martie 2018 21:05:56 | |
---|---|---|---|
Problema | Xor Max | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
ifstream f("xormax.in");
ofstream g("xormax.out");
int main()
{
int s, x, p0=1, p1=1, i=1;
f>>s>>s;
while(f>>x)
{
i++;
if((s^x)>x)
{
s^=x;
p1++;
}
else
{
s=x;
p0=p1=i;
}
}
g<<s<<' '<<p0<<' '<<p1;
f.close();
g.close();
return 0;
}