Submission #923516

# Submission time Handle Problem Language Result Execution time Memory
923516 2024-02-07T11:10:45 Z Ianis Binary Subsequences (info1cup17_binary) C++17
0 / 100
15 ms 4188 KB
#ifdef LOCAL
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <random>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#else
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#define cerr if (false) cerr 
#define endl '\n'
#endif

#define fi first
#define se second

#define sz(a) ((int)(a).size())
#define all(a) (a).begin(), (a).end()

#define lsb(x) (x & (-x))

#define bit(mask, i) (((mask) >> (i)) & 1)
#define popcount(x) __builtin_popcount(x)

#define YES cout << "YES" << endl
#define NO cout << "NO" << endl

using namespace std;

template <typename T>
bool ckmax(T &a, T b) { return a < b ? a = b, true : false; }
template <typename T>
bool ckmin(T &a, T b) { return a > b ? a = b, true : false; }

using ll = long long;
using pii = pair<int, int>;

const int NMAX = 1e6+5;
const int MOD  = 1e9+7;

int n;
int phi[NMAX];

void read() {
   cin >> n;
}

void precalc() {
   for (int i = 2; i < NMAX; i++) {
      phi[i] += i - 1;
      for (int j = 2 * i; j < NMAX; j += i)
         phi[j] -= phi[i];
   }
   phi[1] = 2;
}

void solve() {
   cout << phi[n] << endl << -1 << endl;
}

signed main() {
#ifdef LOCAL
   freopen("input.txt", "r", stdin);
#endif
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   
   int t = 1;
   cin >> t;

   precalc();
   while (t--) {
      read();
      solve();
   }

   return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 4188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 4184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 4188 KB Output isn't correct
2 Halted 0 ms 0 KB -