제출 #636774

#제출 시각아이디문제언어결과실행 시간메모리
636774ogibogi2004Devil's Share (RMI19_devil)C++14
13 / 100
1585 ms340 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long ll D[10],k; void solve1() { vector<int>digits; for(int i=1;i<10;i++) { for(int j=0;j<D[i];j++) { digits.push_back(i); } } vector<int>ans; ll min_of_max=(ll)1e15; ll pw10=1; for(int j=0;j<k;j++)pw10*=10; do { ll num=0,biggestnum=0; for(int j=0;j<k;j++) { num=num*10+digits[j]; } biggestnum=num; for(int j=k;j<digits.size();j++) { num*=10; num+=digits[j]; num%=pw10; biggestnum=max(biggestnum,num); } if(biggestnum<min_of_max) { ans=digits; min_of_max=biggestnum; } }while(next_permutation(digits.begin(),digits.end())); for(auto xd:ans)cout<<xd; cout<<endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t--) { cin>>k; for(int i=1;i<=9;i++)cin>>D[i]; solve1(); } return 0; }

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

devil.cpp: In function 'void solve1()':
devil.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int j=k;j<digits.size();j++)
      |                     ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...