답안 #1019418

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1019418 2024-07-10T19:55:37 Z MarwenElarbi Mensza (COI22_mensza) C++17
0 / 100
664 ms 81804 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define se second
#define fi first
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int nax=1e5+5;
int main() {
    optimise;
    int l,q;
    cin>>l>>q;
    while(q--){
        string text;
        cin>>text;
        if(text[0]=='a'){
            int a;
            cin>>a;
            a+=(1<<20);
            int cur=(1<<20);
            vector<int> v;
            for (int i = 19; i >= 0; --i)
            {
                cur+=((a&(1<<i)) ? (1<<i) : 0);
                if(a&(1<<i)) v.pb(cur);
            }
            for (int i = 0; i < v.size(); ++i)
            {
                cout <<v[i]<<" ";
            }cout <<'\n';
        }else if(text[0]=='b'){
            int b;
            cin>>b;
            b+=(1<<20);
            int cur=(1<<20);
            vector<int> v;
            for (int i = 19; i >= 0; --i)
            {
                cur+=((b&(1<<i)) ? (1<<i) : 0);
                if(!(b&(1<<i))) v.pb(cur+(1<<i));
            }
            for (int i = 0; i < v.size(); ++i)
            {
                cout <<v[i]<<" ";
            }cout <<'\n';
        }else{
            int c;
            cin>>c;
            vector<int> tab(c);
            for (int i = 0; i < c; ++i)
            {
                cin>>tab[i];
            }
            cout << (tab[c-1]==2 ? "A" : "B") <<'\n';
        }
    }

}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:28:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             for (int i = 0; i < v.size(); ++i)
      |                             ~~^~~~~~~~~~
Main.cpp:43:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             for (int i = 0; i < v.size(); ++i)
      |                             ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Integer parameter [name=l_1] equals to 1048577, violates the range [0, 200]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 600 KB Integer parameter [name=l_1] equals to 1048577, violates the range [0, 110]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 664 ms 81804 KB Integer parameter [name=l_1] equals to 1048577, violates the range [0, 20]
2 Halted 0 ms 0 KB -