Submission #1029466

# Submission time Handle Problem Language Result Execution time Memory
1029466 2024-07-20T22:59:35 Z vjudge1 CATS (NOI14_cats) C++17
0 / 25
1500 ms 1732 KB
#include "bits/stdc++.h"
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long q, x, l, n;
    cin>>q;
    vector<int> Patronear;
    long long Cos = 32;
    long long Contador = Cos;
    bool Seguir = 1;
    while(q--){
        cin>>x>>l>>n;
        long long xx = x;
        long long ll = l;
        long long nn = n;
        vector<long long> s1(2222, 0);
        vector<long long> s2(2222, 0);
        while(x > 0){
            /*cout<<s1.back()<<" ";
            cout<<s1[s1.size() - 2]<<" ";
            cout<<s1[s1.size() - 3]<<" ";
            cout<<s1[s1.size() - 4]<<"\n";
            cout<<s2.back()<<" ";
            cout<<s2[s2.size() - 2]<<" ";
            cout<<s2[s2.size() - 3]<<" ";
            cout<<s2[s2.size() - 4]<<"\n";
            cout<<"\n";*/
            s2.push_back(s1.back());
            s1.pop_back();
            for(long long i = 0; i < s1.size(); i++) s1[i] ^= 1;
            /*cout<<s1.back()<<" ";
            cout<<s1[s1.size() - 2]<<" ";
            cout<<s1[s1.size() - 3]<<" ";
            cout<<s1[s1.size() - 4]<<"\n";
            cout<<s2.back()<<" ";
            cout<<s2[s2.size() - 2]<<" ";
            cout<<s2[s2.size() - 3]<<" ";
            cout<<s2[s2.size() - 4]<<"\n";
            cout<<"\n";*/
            if(s2.back() > l){
                x--;
                /*cout<<s2.back()<<" ";
                Contador--;
                //if(Seguir) cout<<s2.back() % 2<<", ";
                if(Contador == 0){
                    cout<<"\n";
                    Contador = Cos;
                    Seguir = 0;
                }*/
                if(x == 0) cout<<s2.back()<<"\n";
                //Patronear.push_back(s2.back());
            } else {
                s2.push_back(n);
                s2.push_back(n);
                long long Suma = s2.back();
                s2.pop_back();
                Suma += s2.back();
                s2.back() = Suma;
                Suma = s2.back();
                s2.pop_back();
                Suma += s2.back();
                s2.back() = Suma;
                s1.push_back(s2.back());
                s1.push_back(s2.back());
                s2.pop_back();
                s2.pop_back();
            }
        }
    }
    /*for(long long i = 0; i < Patronear.size(); i++){
        vector<int> Intento;
        long long j = 0;
        for(; j < i + 1; j++){
            Intento.push_back(Patronear[j]);
        }
        bool Joya = 1;
        while(j < Patronear.size()){
            long long k;
            for(k = 0; k < i + 1 and k < Patronear.size(); k++){
                if(Intento[k] != Patronear[k + j]){
                    Joya = 0;
                    break;
                }
            }
            j = k + 1;
        }
        if(Joya) cout<<i + 1;
        if(Joya) break;
    }*/
    return 0;
}

Compilation message

cats.cpp: In function 'int main()':
cats.cpp:31:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(long long i = 0; i < s1.size(); i++) s1[i] ^= 1;
      |                                  ~~^~~~~~~~~~~
cats.cpp:14:19: warning: unused variable 'xx' [-Wunused-variable]
   14 |         long long xx = x;
      |                   ^~
cats.cpp:15:19: warning: unused variable 'll' [-Wunused-variable]
   15 |         long long ll = l;
      |                   ^~
cats.cpp:16:19: warning: unused variable 'nn' [-Wunused-variable]
   16 |         long long nn = n;
      |                   ^~
cats.cpp:10:15: warning: unused variable 'Contador' [-Wunused-variable]
   10 |     long long Contador = Cos;
      |               ^~~~~~~~
cats.cpp:11:10: warning: unused variable 'Seguir' [-Wunused-variable]
   11 |     bool Seguir = 1;
      |          ^~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 852 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 860 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1585 ms 816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 195 ms 1732 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 278 ms 1612 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -