Submission #464455

#TimeUsernameProblemLanguageResultExecution timeMemory
464455QuentolosseXORanges (eJOI19_xoranges)C++14
30 / 100
217 ms65540 KiB
#include<iostream> #include<vector> using namespace std; int main() { int nboranges, nbActions; cin >> nboranges >> nbActions; vector<int> oranges, resultatsXor; for (int i = 0; i < nboranges; i++) { int entree; cin >> entree; oranges.push_back(entree); } for (int i = 0; i < nbActions; i++) { int typeAction; cin >> typeAction; if (typeAction == 1) { int index, valeur; cin >> index >> valeur; oranges[index - 1] = valeur; } else { int debut, fin; cin >> debut >> fin; resultatsXor.clear(); for (int i = debut - 1; i < fin; i++) { int i2 = 1, total = oranges[i]; resultatsXor.push_back(total); while (i + i2 < fin) { total = total ^ oranges[i + i2]; resultatsXor.push_back(total); i2++; } } int total = resultatsXor[0]; for (int i = 1; i < int(resultatsXor.size()); i++) { total = total ^ resultatsXor[i]; } cout << total << endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...