Submission #960252

# Submission time Handle Problem Language Result Execution time Memory
960252 2024-04-10T03:41:31 Z irmuun Paint By Numbers (IOI16_paint) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
#include "paint.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

string solve_puzzle(string s,vector<int>c){
    int n=s.size(),mn=0;
    for(int i=0;i<c.size();i++){
        mn+=c[i];
    }
    mn+=(int)c.size()-1;
    vector<int>a(n,-1),b(n,-1);
    int j=0;
    for(int i=0;i<c.size();i++){
        for(int k=0;k<c[i];k++){
            a[j]=i;
            s[j++]='X';
        }
        s[j++]='.';
    }
    j=n-1;
    for(int i=c.size()-1;i>=0;i--){
        for(int k=0;k<c[i];k++){
            b[j--]=i;
        }
        j--;
    }
    for(int i=0;i<n;i++){
        if(a[i]==-1||b[i]==-1){
            s[i]='?';
        }
        else if(a[i]==b[i]){
            s[i]='X';
        }
        else{
            s[i]='?';
        }
    }
    return s;
}

Compilation message

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
paint.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 13, m = 1
2 Correct 0 ms 348 KB n = 18, m = 1
3 Correct 0 ms 348 KB n = 17, m = 1
4 Incorrect 1 ms 348 KB Incorrect length: expected: '1', found: '3'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 13, m = 1
2 Correct 0 ms 348 KB n = 18, m = 1
3 Correct 0 ms 348 KB n = 17, m = 1
4 Incorrect 1 ms 348 KB Incorrect length: expected: '1', found: '3'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 13, m = 1
2 Correct 0 ms 348 KB n = 18, m = 1
3 Correct 0 ms 348 KB n = 17, m = 1
4 Incorrect 1 ms 348 KB Incorrect length: expected: '1', found: '3'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 13, m = 1
2 Correct 0 ms 348 KB n = 18, m = 1
3 Correct 0 ms 348 KB n = 17, m = 1
4 Incorrect 1 ms 348 KB Incorrect length: expected: '1', found: '3'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 13, m = 1
2 Correct 0 ms 348 KB n = 18, m = 1
3 Correct 0 ms 348 KB n = 17, m = 1
4 Incorrect 1 ms 348 KB Incorrect length: expected: '1', found: '3'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 13, m = 1
2 Correct 0 ms 348 KB n = 18, m = 1
3 Correct 0 ms 348 KB n = 17, m = 1
4 Incorrect 1 ms 348 KB Incorrect length: expected: '1', found: '3'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 13, m = 1
2 Correct 0 ms 348 KB n = 18, m = 1
3 Correct 0 ms 348 KB n = 17, m = 1
4 Incorrect 1 ms 348 KB Incorrect length: expected: '1', found: '3'
5 Halted 0 ms 0 KB -