1 solutions

  • 0
    @ 2025-11-5 17:29:20

    C++ :

    #include <cstdio>
    #include <iostream>
    #include <algorithm>
    #define rep(i,a,b) for(int i=a;i<=b;i++)
    #define dep(i,a,b) for(int i=a;i>=b;i--)
    using namespace std;
    typedef unsigned long long uLL;
    const int N = 100000; 
    uLL a[N];
    uLL F(uLL x){
    	uLL t = ((19 * x * x * x)+(98 * x * x))+((12 * x)+14);
    	t = t * t * t;
    	return t;
    }
    int ans[N];
    int main(){
    	int n,q; scanf("%d%d",&n,&q);
    	rep(i,1,q) scanf("%llu",&a[i]);
    	rep(i,1,n)
    		if (a[q] >> 26 == F(i) >> 26){
    			ans[q] = i;
    			dep(i, q, 2) ans[i - 1] = a[i] ^ F(ans[i]);
    			rep(i, 1, q) printf("%d\n",ans[i]);
    			return 0;
    		}
    	return 0;
    }
    
    • 1

    Information

    ID
    18480
    Time
    1000ms
    Memory
    10MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By