답안 #864203

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864203 2023-10-22T08:42:33 Z noobcodur Mensza (COI22_mensza) C++17
34 / 100
5000 ms 170524 KB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define forn(i,j) for(ll i = 0; i < j; i++)
#define forrange(i,j,k) for(int i = j; i < k; ++i)
#define rof(i,j) rof(int i = j; i >= 0; --i)
#define pii pair<int,int>
#define vll vector<ll>
#define vi vector<int>
#define vvll vector<vll>
#define vvi vector<vi>
#define vb vector<bool>
#define pb push_back
#define p push
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define debug(x) cerr << #x << " is " << x << endl;

#define MOD 1000000007

int main(){
	int l,q;
	cin >> l >> q;

	while(q--){
		string s;
		ll h;
		cin >> s >> h;

		if(s == "alojzije"){
			ll v = (1 << 20);
			vll a;

			for(int i = 19; i >= 0; --i){
				if((1 << i) & h){
					v += (1 << i);
					a.pb(v);
				}
			}

			cout << a.size() << " ";

			for(int i = 0; i < a.size(); ++i){
				cout << a[i] << " ";
			}

			cout << endl;
		}

		if(s == "benjamin"){
			ll v = (1 << 20);
			vll b;

			for(int i = 19; i >= 0; --i){
				if((1 << i) & h ){
					v += (1 << i);
				}

				if(!((1 << i) & h)){
					ll m = (1 << i);
					b.pb(v+m);
				}
			}

			cout << b.size() << " ";

			forn(i,b.size()){
				cout << b[i] << " ";
			}

			cout << endl;
		}

		if(s == "cecilija"){
			int t = 0;
			
			while(h--){
				int a;
				cin >> a;

				if(a > 1){
					t++;
				}
			}

			if(t == 0){
				cout << "B" << endl;
			}

			else{
				cout << "A" << endl;
			}
		}
	}
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:49:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |    for(int i = 0; i < a.size(); ++i){
      |                   ~~^~~~~~~~~~
Main.cpp:8:35: 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]
    8 | #define forn(i,j) for(ll i = 0; i < j; i++)
......
   73 |    forn(i,b.size()){
      |         ~~~~~~~~~~                 
Main.cpp:73:4: note: in expansion of macro 'forn'
   73 |    forn(i,b.size()){
      |    ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3666 ms 3188 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5064 ms 170524 KB Time limit exceeded
2 Halted 0 ms 0 KB -