제출 #1066056

#제출 시각아이디문제언어결과실행 시간메모리
1066056Ahmed57비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1088 ms16396 KiB
#include "bits/stdc++.h" using namespace std; #define int long long vector<int> A; int lim , X; long long count_tastiness(long long x,vector<long long> a){ A.clear(); for(int i = 0;i<a.size();i++)A.push_back(a[i]); int k = A.size(); int ans = 0; for(int i = 0;i<A.size();i++){ ans/=2; ans+=A[i]; } while(ans>=x){ ans/=2; A.push_back(0); } k = A.size(); lim = k; X = x; vector<array<int,2>> lol; lol.push_back({0,1}); for(int i = 0;i<A.size();i++){ vector<array<int,3>> nlol; int it1 = 0; int it2 = 0; while(it2<lol.size()&&lol[it2][0]+A[i]<X)it2++; while(it1<lol.size()||it2<lol.size()){ if(it2==lol.size()||(lol[it1][0]+A[i])/2<=(lol[it2][0]+A[i]-X)/2){ nlol.push_back({(lol[it1][0]+A[i])/2,lol[it1][1]}); it1++; }else{ nlol.push_back({(lol[it2][0]+A[i]-X)/2,lol[it2][1]}); it2++; } } lol.clear(); for(int j = 0;j<nlol.size();){ int it = j; int sum = 0; while(it<nlol.size()&&nlol[it][0]==nlol[j][0]){ sum+=nlol[it][1]; it++; } lol.push_back({nlol[j][0],sum}); j = it; } } long long all = 0; for(int i = 0;i<lol.size();i++){ all+=lol[i][1]; } return all; }

컴파일 시 표준 에러 (stderr) 메시지

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:9:20: 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]
    9 |     for(int i = 0;i<a.size();i++)A.push_back(a[i]);
      |                   ~^~~~~~~~~
biscuits.cpp:12:20: 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]
   12 |     for(int i = 0;i<A.size();i++){
      |                   ~^~~~~~~~~
biscuits.cpp:25:20: 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]
   25 |     for(int i = 0;i<A.size();i++){
      |                   ~^~~~~~~~~
biscuits.cpp:29:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         while(it2<lol.size()&&lol[it2][0]+A[i]<X)it2++;
      |               ~~~^~~~~~~~~~~
biscuits.cpp:30:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         while(it1<lol.size()||it2<lol.size()){
      |               ~~~^~~~~~~~~~~
biscuits.cpp:30:34: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         while(it1<lol.size()||it2<lol.size()){
      |                               ~~~^~~~~~~~~~~
biscuits.cpp:31:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             if(it2==lol.size()||(lol[it1][0]+A[i])/2<=(lol[it2][0]+A[i]-X)/2){
      |                ~~~^~~~~~~~~~~~
biscuits.cpp:40:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int j = 0;j<nlol.size();){
      |                       ~^~~~~~~~~~~~
biscuits.cpp:43:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             while(it<nlol.size()&&nlol[it][0]==nlol[j][0]){
      |                   ~~^~~~~~~~~~~~
biscuits.cpp:52:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     for(int i = 0;i<lol.size();i++){
      |                   ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...