Submission #1231072

#TimeUsernameProblemLanguageResultExecution timeMemory
1231072salmonMensza (COI22_mensza)C++20
100 / 100
10 ms840 KiB
#include <bits/stdc++.h> using namespace std; int L; int Q; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> L >> Q; if(L < 110) return 0; for(int i = 0; i < Q; i++){ string s; cin >> s; if(s == "alojzije"){ int h; cin >> h; vector<int> v; for(int i = 0; i < 10; i++){ for(int j = 0; j < i; j++){ v.push_back(i); v.push_back(i); } } for(int i = 0; i < 10; i++){ if((h&(1<<i)) > 0){ v.push_back(i); } } printf("%d\n",v.size()); for(int i : v) printf("%d ",i); printf("\n"); } else if(s == "benjamin"){ int h; cin >> h; vector<int> v; for(int i = 0; i < 10; i++){ for(int j = 0; j < i; j++){ v.push_back(i); v.push_back(i); } } for(int i = 0; i < 10; i++){ if((h&(1<<i)) > 0){ v.push_back(i); v.push_back(i); } } printf("%d\n",v.size()); for(int i : v) printf("%d ",i); printf("\n"); } else{ int h; cin >> h; vector<int> v; for(int i = 0; i < h; i++){ int h1; cin >> h1; v.push_back(h1); } if(h == 9) v.push_back(0); sort(v.begin(),v.end()); int num1 = 0; int num2 = 0; h = v.size(); for(int i = 0; i < h; i++){ int h1; h1 = v[i] - i * 4; if(h1%2 == 1){ num1 += (1<<i); } h1 /= 2; if(h1%2 == 1){ num2 += (1<<i); } } if(num1 > num2) cout << "A\n"; else cout << "B\n"; } } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:39:34: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   39 |                         printf("%d\n",v.size());
      |                                 ~^    ~~~~~~~~
      |                                  |          |
      |                                  int        std::vector<int>::size_type {aka long unsigned int}
      |                                 %ld
Main.cpp:63:34: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   63 |                         printf("%d\n",v.size());
      |                                 ~^    ~~~~~~~~
      |                                  |          |
      |                                  int        std::vector<int>::size_type {aka long unsigned int}
      |                                 %ld
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...