Submission #1039273

#TimeUsernameProblemLanguageResultExecution timeMemory
1039273alexander707070Costinland (info1cup19_costinland)C++14
11.95 / 100
0 ms412 KiB
#include<bits/stdc++.h> using namespace std; long long k,del; int x,y; char s[100][100]; vector< vector<char> > mults[5]={ {{'X','d'},{'r','.'}} , {{'X','.','d'},{'X','.','d'},{'r','r','.'}} , {{'X','X','X','d'},{'X','.','.','d'},{'.','.','.','d'},{'r','r','r','.'}} , {{'X','X','d','d'},{'X','X','d','d'},{'X','r','.','d'},{'r','r','r','.'}} , {{'X','X','X','d'},{'X','X','d','d'},{'X','X','.','d'},{'r','r','r','.'}} }; void build(int id){ if(id<5){ for(int i=0;i<mults[id].size();i++){ for(int f=0;f<mults[id].size();f++){ s[i+x][f+y]=mults[id][i][f]; } } x+=mults[id].size()-1; y+=mults[id].size()-1; }else{ s[x][y]='X'; if(x>y){ y++; }else x++; } } int main(){ cin>>k; x=1; y=1; long long del=1; while(k>1){ if(k%2==0){ build(0); k/=2; del*=2; }else if(k%3==0){ build(1); k/=3; del*=3; }else if(k%5==0){ build(2); k/=5; del*=5; }else if(k%7==0){ build(3); k/=7; del*=7; }else if(k%11==0){ build(4); k/=11; del*=11; }else{ build(5); k-=del; } } x++; y++; for(int i=1;i<=x;i++)s[i][y]='d'; for(int i=1;i<=y;i++)s[x][i]='r'; s[x][y]='.'; cout<<x<<" "<<y<<"\n"; for(int i=1;i<=x;i++){ for(int f=1;f<=y;f++){ if(s[i][f]==0)s[i][f]='.'; cout<<s[i][f]; } cout<<"\n"; } return 0; }

Compilation message (stderr)

costinland.cpp: In function 'void build(int)':
costinland.cpp:15:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         for(int i=0;i<mults[id].size();i++){
      |                     ~^~~~~~~~~~~~~~~~~
costinland.cpp:16:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |             for(int f=0;f<mults[id].size();f++){
      |                         ~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...