Submission #574793

#TimeUsernameProblemLanguageResultExecution timeMemory
574793Valters07Painting Squares (IOI20_squares)C++14
100 / 100
159 ms576 KiB
#include <bits/stdc++.h>
#include "squares.h"
#pragma GCC optimize("O2,unroll-loops")
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define en cin.close();return 0;
#define pb push_back
#define fi first//printf("%lli\n",cur);
#define se second//scanf("%lli",&n);
#define r0 return 0;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string lol = "000000000010000000011000000010100000001110000001001000000101100000011010000001111000001000100000100110000010101000001011100000110010000011011000001110100000111110000100001000110000100101000010011100001010010000101011000010110100001011110000110001000011001100001101010000110111000011100100001110110000111101000011111100010001010001000111000100100100010010110001001101000100111100010100110001010101000101011100010110010001011011000101110100010111110001100011001010001100111000110100100011010110001101101000110111100011100110001110101000111011100011110010001111011000111110100011111110010010011001001010100100101110010011011001001110100100111110010100101001110010101011001010110100101011110010110011001011010100101101110010111011001011110100101111110011001101001100111100110101010011010111001101101100110111010011011111001110011101011001110110100111011110011110101001111011100111110110011111101001111111101010101011101010110110101011111010110101101111010111011101011110110101111111011011011101101111110111011111011110111111111000000000";
vector<int> paint(int n)
{
	vector<int> labels(n+1);
    for(int i = 0;i<n;i++)
        labels[i]=lol[i]-48;
	labels.back()=min(n,10);
	return labels;
}
int find_location(int n, vector<int> c)
{
    int it = 0;
    while(it<c.size()&&c[it]!=-1)
        it++;
    if(it!=c.size())
        return n-it;
    for(it = 0;;it++)
    {
        bool ok = 1;
        for(int i = it;i<it+c.size();i++)
            ok&=(lol[i]-48==c[i-it]);
        if(ok)
            return it;
    }
    assert(0);
}

Compilation message (stderr)

squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:17:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   17 |     for(int i = 0;i<n;i++)
      |     ^~~
squares.cpp:19:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   19 |  labels.back()=min(n,10);
      |  ^~~~~~
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:25:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     while(it<c.size()&&c[it]!=-1)
      |           ~~^~~~~~~~~
squares.cpp:27:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     if(it!=c.size())
      |        ~~^~~~~~~~~~
squares.cpp:32:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for(int i = it;i<it+c.size();i++)
      |                        ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...