Submission #1039273

# Submission time Handle Problem Language Result Execution time Memory
1039273 2024-07-30T15:54:01 Z alexander707070 Costinland (info1cup19_costinland) C++14
11.9514 / 100
0 ms 412 KB
#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

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 time Memory Grader output
1 Correct 0 ms 344 KB Correct! Your size: 4
2 Correct 0 ms 348 KB Correct! Your size: 4
3 Correct 0 ms 348 KB Correct! Your size: 5
4 Correct 0 ms 412 KB Correct! Your size: 5
5 Correct 0 ms 344 KB Correct! Your size: 5
6 Correct 0 ms 348 KB Correct! Your size: 5
7 Partially correct 0 ms 348 KB Partially Correct! Your size: 6
8 Partially correct 0 ms 348 KB Partially Correct! Your size: 6
9 Partially correct 0 ms 348 KB Partially Correct! Your size: 8
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -