Submission #1120255

#TimeUsernameProblemLanguageResultExecution timeMemory
1120255vjudge1Tracks in the Snow (BOI13_tracks)C++17
0 / 100
2 ms524 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ld double


const int INF = 1e18;
const int mod = 12345;
const int sz = 1e5 + 5;

bool pal(string z)
{
    int x = stoi(z);
    int xc = x;
    int cur = 1;
    int res = 0;
    while(xc > 0)
    {
        int maks = -1;
        for(int i = 1;i <= 18;i++)
        {
            if(pow(10 , i) <= xc) maks = pow(10 , i);
        }
        res += (cur * (xc / maks));
        cur *= 10;
        xc /= 10;
    }
    cout << res << ' ';
    return res == x;
}

bool f(int x)
{
    string s;
    s = to_string(x);
    for(int i = 0;i < s.size() - 1;i++)
    {
        string c = "";
        c += s[i];
        for(int j = i + 1;j < s.size();j++)
        {
            c += s[j];
            if(c[0] == c[c.size() - 1] && c[1] == c[c.size() - 2]){
                    if(pal(c)) return false;
            }
        }
    }
    return true;
}

signed main()
{
   ios_base::sync_with_stdio(0);cin.tie(0);
   cout << 2 << endl;
}

Compilation message (stderr)

tracks.cpp: In function 'bool f(long long int)':
tracks.cpp:37:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i = 0;i < s.size() - 1;i++)
      |                   ~~^~~~~~~~~~~~~~
tracks.cpp:41:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int j = i + 1;j < s.size();j++)
      |                           ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...