Submission #763212

# Submission time Handle Problem Language Result Execution time Memory
763212 2023-06-22T06:48:36 Z vjudge1 Xylophone (JOI18_xylophone) C++14
0 / 100
1 ms 208 KB
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("bmi,bmi2,lzcnt,popcnt")
//#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
//#pragma expected_value
//#pragma isolated_call
//#pragma disjoint

#include "xylophone.h"
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

//using namespace __gnu_pbds;
using namespace std;

//#define int long long
//#define double long double
#define Fi first
#define Se second
#define Rep(i,a,b) for (int i=a;i<=b;++i)
#define Repu(i,b,a) for (int i=b;i>=a;--i)
#define pb push_back
#define ms(a,i) memset(a,i,sizeof(a))
#define sz size()
#define mp make_pair
#define endl '\n'
#define sef setprecision(12)<<fixed
#define cer cout<<"cak"<<endl;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<double> va;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<va> vva;

//const double EPS=1e-9;
const double PI=acos(-1);
//const int oo=1e18;
const int MN=5000+5;
const int mod=1e9+7;

using cd=complex<double>;

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

int a[MN];

void solve(int n) {
	vi two(n+1,0), three(n+1,0);
	Rep(i,1,n-1) two[i] = query(i,i+1);
	Rep(i,1,n-2) three[i] = query(i,i+2);

	int up=1;
	a[1] = 0; a[2] = two[1];

	Rep(i,3,n) {
		if(two[i-2] + two[i-1] != three[i-2]) up = 1-up;
		a[i+2] = a[i-1] + two[i-1]*(2*up-1);
	}

	int posn, posx;
	int mx=0,mn=0;

	Rep(i,2,n) {
		if(a[i]>mx) {
			mx=a[i];
			posx=i;
		}
		if(a[i]<mn) {
			posn=i;
			mn=a[i];
		}
	}

	if(posn<posx) {
		Rep(i,1,n) answer(i,a[i]-mn+1);
	}
	else {
		Rep(i,1,n) answer(i,mx-a[i]+1);
	}
}

Compilation message

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:75:2: warning: 'posn' may be used uninitialized in this function [-Wmaybe-uninitialized]
   75 |  if(posn<posx) {
      |  ^~
xylophone.cpp:75:2: warning: 'posx' may be used uninitialized in this function [-Wmaybe-uninitialized]
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -