Submission #238655

#TimeUsernameProblemLanguageResultExecution timeMemory
238655VimmerPictionary (COCI18_pictionary)C++14
0 / 140
66 ms2680 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-O3") #pragma GCC optimize("Ofast") //#pragma GCC optimize("fast-math") //#pragma GCC optimize("no-stack-protector") #define F first #define S second #define sz(x) int(x.size()) #define pb push_back #define N 100001 #define M ll(1e9 + 7) #define inf 1e9 + 1e9 using namespace std; //using namespace __gnu_pbds; typedef long double ld; typedef long long ll; typedef short int si; typedef array <int, 2> a2; //typedef tree <int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; vector <pair <int, int> > g; int main() { //freopen("input.txt", "r", stdin); //freopen("output4.txt", "w", stdout); ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; g.resize(n); for (int i = 0; i < n; i++) { int x; cin >> x; g[i] = {x, i}; } sort(g.begin(), g.end()); int j = 1; pair <int, int> ans[n]; for (int i = 0; i < n; i++) { while ((j + 1) * (j + 1) <= g[i].F) j++; if (i != 0 && g[i].F == g[i - 1].F) ans[g[i].S] = ans[g[i - 1].S]; for (int u = 2; u <= j; u++) if (g[i].F % u == 0 && __gcd(u + g[i].F / u, g[i].F) == 1) {ans[g[i].S] = {u, g[i].F / u}; break;} if (ans[g[i].S].F == 0) ans[g[i].S] = {-1, -1}; } for (int i = 0; i < n; i++) cout << ans[i].F << " "; cout << endl; for (int i = 0; i < n; i++) cout << ans[i].S << " "; }

Compilation message (stderr)

pictionary.cpp: In function 'int main()':
pictionary.cpp:71:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = 0; i < n; i++) cout << ans[i].F << " "; cout << endl;
     ^~~
pictionary.cpp:71:58: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     for (int i = 0; i < n; i++) cout << ans[i].F << " "; cout << endl;
                                                          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...