Submission #610821

#TimeUsernameProblemLanguageResultExecution timeMemory
610821CoolRabbitXTPaint By Numbers (IOI16_paint)C++14
32 / 100
1 ms308 KiB
#include "paint.h" #include <bits/stdc++.h> using namespace std; #include <cstdlib> int n; int variacion; int clue_sum = 0; int bit_counter = 0; int bit_count_int; const int NMAX = 101; bitset <NMAX>bit_rep; bitset <NMAX> answer; string result (NMAX, '?'); bitset <NMAX> original; std::string solve_puzzle(std::string s, std::vector<int> c) { n = s.size(); for(int i = 0; i< c.size(); i++){ clue_sum += c[i]; } variacion = n - (c.size() -1 + clue_sum); for(int i = 0; i< c.size(); i++){ bit_count_int = bit_counter; for(int j = bit_count_int; j < c[i] + bit_count_int; j++){ bit_rep.set(NMAX - j -1, 1); bit_counter ++; } if(i != c.size() -1){ bit_counter ++; } } answer = bit_rep; original = bit_rep; for(int i = 0; i<variacion; i++){ answer = answer & bit_rep >> 1; bit_rep >>= 1; } for(int i = 0; i<n; i++) result[i] = '?'; for(int i = 0; i< n; i++){ if(answer[NMAX - i -1]) result[i] = 'X'; } bit_rep = original; answer = ~bit_rep; bit_rep = ~bit_rep; for(int i = 0; i<variacion; i++){ answer = answer & bit_rep >> 1; bit_rep >>= 1; } for(int i = 0; i< n; i++){ if(answer[NMAX - i -1]) result[i] = '_'; } result.resize(n); //cout << result << endl; return result; }

Compilation message (stderr)

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:17:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for(int i = 0; i< c.size(); i++){
      |                    ~^~~~~~~~~~
paint.cpp:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i = 0; i< c.size(); i++){
      |                    ~^~~~~~~~~~
paint.cpp:32:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |       if(i != c.size() -1){
      |          ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...