Submission #464428

# Submission time Handle Problem Language Result Execution time Memory
464428 2021-08-13T08:17:36 Z Quentolosse Rack (eJOI19_rack) C++14
40 / 100
102 ms 102404 KB
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main()
{
    int nbEtages, nbCrochets, nbManteauxAPoser;
    cin >> nbEtages >> nbManteauxAPoser;
    vector<int> manteaux;
    nbCrochets = pow (2, nbEtages);
    manteaux.push_back (1);
    manteaux.push_back((nbCrochets / 2) + 1);
    int i = 1, debut = 1;
    while (manteaux.size() < nbManteauxAPoser)
    {
        for (int i2 = 0; i2 < i; i2++)
        {
            manteaux.push_back(manteaux[debut + i2] - (nbCrochets / (i * 4)));
        }
        for (int i2 = 0; i2 < i; i2++)
        {
            manteaux.push_back(manteaux[debut + i2] + (nbCrochets / (i * 4)));
        }
        debut += i;
        i = i * 2;
        
    }
    cout << manteaux[nbManteauxAPoser - 1];
    return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:16:28: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while (manteaux.size() < nbManteauxAPoser)
      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 588 KB Output is correct
9 Correct 2 ms 1348 KB Output is correct
10 Correct 2 ms 1348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 588 KB Output is correct
9 Correct 2 ms 1348 KB Output is correct
10 Correct 2 ms 1348 KB Output is correct
11 Runtime error 102 ms 102404 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -