Submission #301401

#TimeUsernameProblemLanguageResultExecution timeMemory
301401c4ts0upPaint By Numbers (IOI16_paint)C++17
0 / 100
1 ms256 KiB
// c4ts0up // Alvaro Bacca - COL3 #include "paint.h" #include <bits/stdc++.h> #define pb push_back #define ff first #define ss second using namespace std; int n, k; vector <int> ps; vector <int> ade, atr; string cad; // encuentra la interseccion de [a] union [b]. devuelve {-1,-1} si no hay pair <int,int> interseccion(pair <int,int> a, pair <int,int> b) { pair <int,int> res = {b.ff, a.ss}; if (b.ff > a.ss) return {-1,-1}; else return res; } string solve_puzzle(string s, vector<int> c) { n = c.size(); k = s.size(); // llenamos el de adelante for (int i=0; i<n; i++) { for (int j=0; j<c[i]; j++) ade.pb(i+1); if (ade.size()+1 <= k) ade.pb(-(i+1)); } while (ade.size() < k) ade.pb(-n); // llenamos el reverso for (int i=n-1; i>=0; i--) { for (int j=0; j<c[i]; j++) atr.pb(i+1); if (atr.size()+1 <= k && i>0) atr.pb(-(i)); } while (atr.size() < k) atr.pb(-n); reverse(atr.begin(), atr.end()); //*// cout << "ade := "; for (int x : ade) cout << x << ", "; cout << endl; cout << "atr := "; for (int x : atr) cout << x << ", "; cout << endl; //*/ // crea la cadena for (int i=0; i<k; i++) { if (ade[i] == atr[i]) cad += (ade[i] > 0 ? "X" : "_"); else cad += "?"; } return cad; }

Compilation message (stderr)

paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:30:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |         if (ade.size()+1 <= k) ade.pb(-(i+1));
      |             ~~~~~~~~~~~~~^~~~
paint.cpp:32:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |     while (ade.size() < k) ade.pb(-n);
      |            ~~~~~~~~~~~^~~
paint.cpp:37:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |         if (atr.size()+1 <= k && i>0) atr.pb(-(i));
      |             ~~~~~~~~~~~~~^~~~
paint.cpp:39:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |     while (atr.size() < k) atr.pb(-n);
      |            ~~~~~~~~~~~^~~
#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...