QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#86455 | #1902. Computational ethnography | triplem5ds# | WA | 2ms | 3396kb | C++20 | 1.9kb | 2023-03-09 21:57:37 | 2023-03-09 21:57:40 |
Judging History
answer
///Enta etfsh5t nseet el rank
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
tree_order_statistics_node_update>;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for (int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
//#define mp(x, y) make_pair(x, y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll
using ll = long long;
using ull = unsigned long long;
using uint = uint32_t;
using ii = pair<int, int>;
const int N = 3e6 + 6, A = 26, LG = 18, MOD = (119 << 23) + 1;
const long double PI = acos(-1);
const long double EPS = 1e-9;
const ll INF = 1e15;
bool isSquare(int x) {
int lo = 1, hi = 1e6;
while (lo < hi) {
int md = lo + (hi - lo) / 2;
if (md * md >= x)
hi = md;
else
lo = md + 1;
}
return lo * lo == x;
}
int rev(int x) {
if (x % 10 == 0)return 0;
int ret = 0;
while (x) {
ret = ret * 10 + (x % 10);
x /= 10;
}
return ret;
}
void doWork() {
int L, R;
cin >> L >> R;
int ans = 0;
for (int i = 1; i * i <= R; i++) {
if (i * i >= L && isSquare(rev(i * i))) {
cout << i * i << '\n';
}
}
cout << ans << '\n';
}
int32_t main() {
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
int t = 1;
// cin >> t;
while (t--)
doWork();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3396kb
input:
1 1000
output:
1 4 9 121 144 169 441 484 676 961 0
result:
wrong answer 1st numbers differ - expected: '10', found: '1'