Submission #315527

#TimeUsernameProblemLanguageResultExecution timeMemory
315527daniel920712Costinland (info1cup19_costinland)C++14
0 / 100
73 ms65540 KiB
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <vector> #include <queue> using namespace std; long long con[65][65]={0}; vector < pair < long long , long long > > all; vector < char > ans[65]; priority_queue < pair < long long , pair < long long , long long > > ,vector < pair < long long , pair < long long , long long > > >, less < pair < long long , pair < long long , long long > > > > how; int main() { long long i,j,N=0,M=0,now=0,n; scanf("%lld",&n); con[1][1]=1; for(i=1;i<=5;i++) { for(j=1;j<=5;j++) { if(i>1) con[i][j]+=con[i-1][j]; if(j>1) con[i][j]+=con[i][j-1]; if(con[i][j]>1e18) con[i][j]=0; how.push(make_pair(con[i][j],make_pair(i,j))); } } while(n) { //printf("%lld\n",n); while(n<how.top().first) how.pop(); all.push_back(how.top().second); n-=how.top().first; N=max(N,how.top().second.first); M+=how.top().second.second; } //printf("%lld %lld\n",N,M); for(i=0;i<N;i++) { for(j=0;j<M;j++) { ans[i].push_back('X'); } } for(auto i:all) { //printf("%lld %lld\n",i.first,i.second); for(j=0;j<N-i.first;j++) ans[j][now]='d'; for(j=now;j<now+i.second;j++) ans[0][j]='r'; for(j=N-i.first;j<N;j++) ans[j][now+i.second-1]='d'; now+=i.second; } ans[0][0]='X'; for(i=0;i<N;i++) ans[i][M-1]='d'; for(i=0;i<M;i++) ans[N-1][i]='r'; ans[N-1][M-1]='.'; printf("%lld %lld\n",N,M); for(i=0;i<N;i++) { for(j=0;j<M;j++) printf("%c",ans[i][j]); printf("\n"); } return 0; }

Compilation message (stderr)

costinland.cpp: In function 'int main()':
costinland.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |     scanf("%lld",&n);
      |     ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...