Submission #464455

# Submission time Handle Problem Language Result Execution time Memory
464455 2021-08-13T08:53:07 Z Quentolosse XORanges (eJOI19_xoranges) C++14
30 / 100
217 ms 65540 KB
#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 time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 840 KB Output is correct
2 Correct 40 ms 840 KB Output is correct
3 Correct 47 ms 868 KB Output is correct
4 Correct 181 ms 908 KB Output is correct
5 Correct 179 ms 840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 42 ms 840 KB Output is correct
7 Correct 40 ms 840 KB Output is correct
8 Correct 47 ms 868 KB Output is correct
9 Correct 181 ms 908 KB Output is correct
10 Correct 179 ms 840 KB Output is correct
11 Runtime error 217 ms 65540 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 162 ms 65540 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 284 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 2 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 42 ms 840 KB Output is correct
7 Correct 40 ms 840 KB Output is correct
8 Correct 47 ms 868 KB Output is correct
9 Correct 181 ms 908 KB Output is correct
10 Correct 179 ms 840 KB Output is correct
11 Runtime error 217 ms 65540 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -