Submission #531002

# Submission time Handle Problem Language Result Execution time Memory
531002 2022-02-27T10:04:58 Z N1NT3NDO Ekoeko (COCI21_ekoeko) C++14
0 / 110
1 ms 204 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) (int)x.size()
#define fi first
#define sd second
#define all(x) x.begin(), x.end()
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int f(string a, string b)
{
    int ans = 0;
    for(int i = 0; i < sz(a); i++)
    {
        if (a[i] != b[i])
        {
            int nom;
            for(int j = i + 1; j < sz(b); j++)
              if (a[i] == b[j])
                {
                    nom = j;
                    break;
                }
            cout << "bad" << endl;
            cout << a << ' ' << b << endl;
            cout << nom << endl;

            for(int j = nom; j > i; j--) swap(b[j], b[j - 1]), ans++;
        }
    }

    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
//    ll ans = n * 1ll * (n - 1) / 2ll;
    int ans = 0;
    n -= 2;
    while(n > 0)
    {
        ans += n;
        ans += n;

        n -= 2;
    }

    cout << ans;
}

Compilation message

Main.cpp: In function 'int f(std::string, std::string)':
Main.cpp:26:17: warning: 'nom' may be used uninitialized in this function [-Wmaybe-uninitialized]
   26 |             int nom;
      |                 ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -