id
int64
251M
307M
language
stringclasses
12 values
verdict
stringclasses
290 values
source
stringlengths
0
62.5k
problem_id
stringclasses
500 values
type
stringclasses
2 values
291,582,075
Python 3
OK
def solve(): n = int(input()) h = map(int, input().split()) m = {} for i in h: m[i] = m.get(i, 0) + 1 print(n - max(m.values())) t = int(input()) for i in range(t): solve()
2031A
right_submission
291,615,319
Python 3
OK
from collections import Counter tc = int(input()) for _ in range(tc): n = int(input()) v = list(map(int, input().split())) freq = Counter(v) max_frequency = max(freq.values()) print(n - max_frequency)
2031A
right_submission
300,368,503
PyPy 3-64
OK
for _ in range(int(input())): n=int(input()) a=list(map(int,input().split())) f={} for i in a: if i in f: f[i]+=1 else: f[i]=1 mx=max(f.values()) print(n-mx)
2031A
right_submission
297,915,599
Java 8
OK
import java.util.Scanner; public class Penchik_and_modern_monument{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(),min=sc.nextInt(),l=1,m=1; for(int i=1;i<n;i++){ int a=sc.nextInt(); if(a==min)l++; else{ m=Math.max(m,l); l=1; } min=a; } System.out.println(n-Math.max(m,l)); } } }
2031A
right_submission
291,618,956
Java 21
OK
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-- > 0){ int n = s.nextInt(); int a[] = new int[n]; int min = -1, ans = 0; for(int i = 0;i < n; i++){ a[i] = s.nextInt(); } if(n == 1){ System.out.println("0"); continue; } int dp[] = new int[n]; for(int i = 1;i < n; i++){ dp[i] = 1; for (int j = 0; j < i; j++) { if (a[i] >= a[j]) { // dp[i] = Math.max(dp[i], dp[j] + 1); dp[i]++; } } } for(int i = 0; i < n; i++){ ans = Math.max(ans, dp[i]); // System.out.println(dp[i]); } System.out.println(n - ans); } } }
2031A
right_submission
291,587,816
Java 8
OK
import java.util.*; import java.io.*; import static java.lang.Math.*; import java.util.stream.Collectors; @SuppressWarnings("unused") public class Tej { public static void tej(FastIO sc) { int n = sc.nextInt(); int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = sc.nextInt(); int max=1; for(int i=0; i<n-1; i++) { int tmp=1; while(i<n-1 && a[i]==a[i+1]) { tmp++; i++; } max=Math.max(max, tmp); } System.out.println(n-max); } public static void main(String[] args) { FastIO sc = new FastIO(); int t = sc.nextInt(); while(t-->0) { tej(sc); } sc.close(); } } class FastIO extends PrintWriter { private InputStream stream; private byte[] buf = new byte[1 << 16]; private int pChar; private int iChars; public FastIO() { this(System.in, System.out); } public FastIO(InputStream i, OutputStream o) { super(o); stream = i; } public FastIO(String i, String o) throws IOException { super(new FileWriter(o)); stream = new FileInputStream(i); } private int nextByte() { if (iChars == -1) { throw new InputMismatchException(); } if (pChar >= iChars) { pChar = 0; try { iChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (iChars == -1) { return -1; } } return buf[pChar++]; } public String next() { int c; do { c = nextByte(); } while (c <= ' '); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = nextByte(); } while (c > ' '); return res.toString(); } public int nextInt() { int c; do { c = nextByte(); } while (c <= ' '); int sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); } int res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res = 10 * res + c - '0'; c = nextByte(); } while (c > ' '); return res * sgn; } public long nextLong() { long c; do { c = nextByte(); } while (c <= ' '); long sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); } long res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res = 10 * res + c - '0'; c = nextByte(); } while (c > ' '); return res * sgn; } public double nextDouble() { return Double.parseDouble(next()); } }
2031A
right_submission
292,881,421
C++17 (GCC 7-32)
OK
#include <bits/stdc++.h> #define ll long long #define pii pair<int,int> #define pll pair<long long , long long> #define vi vector<int> using namespace std; ll M = 1000000007; int MM = 998244353 ; ll MMM = 1e18 + 4; ll powpow(ll a, ll b) { if(b==1) return a; ll x = powpow(a,b/2)%M; if(b%2) return (((a*x)%M)*x)%M; return (x*x)%M; } bool compareRowSize(const std::vector<int>& a, const std::vector<int>& b) { return a.size() > b.size(); } bool cmp(pair<pair<int,int>,int>& a , pair<pair<int,int>,int>&b) { if(a.first.first == b.first.first) { return a.second > b.second ; } return a.first.first<b.first.first; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--) { map<int,int>mp; int n ; cin>>n; vi a(n); for(auto&x : a) { cin>>x; mp[x]++; } int ans = 0 ; for(auto& x: mp) ans = max(ans, x.second); cout<< n - ans <<"\n"; } }
2031A
right_submission
293,987,520
C++20 (GCC 13-64)
OK
#include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <cmath> #include <string> #include <chrono> #include <deque> #include<climits> #include <set> #include <map> #include <ctime> #include<random> #include <queue> #include <stack> #include <unordered_map> #include<unordered_set> #define mod 1000000007 #define MOD 998244353 #define pb push_back #define ff first #define ss second #define int long long int #define rep(i, n) for (int i = 0; i < (n); i++) template<class T, class U> inline bool chmin(T& a, const U& b) { if (a > b) { a = b; return true; } return false; } // const int m=2e5; // typedef long long int ll; using namespace std; typedef pair<int,int> pt; typedef vector<int> vi; const int N = 1e5 + 5; // vi fact(N,1); // vi rev(N,1); vi fact={1}; vi rev={1}; // fact[0]=1; // vector<int> v; // vector<int> a(300000); // vector<int> arr; // // vi a(100); // // typedef long long ll; // vector<int> dp; // vector<bool> used; // vector<vector<int>> sl; // ll n; // vector<pair<ll,ll>> a(N); // int mn[N]; // #define int long long // typedef vector<long long> vll; int setBitNumber(int n) { if (n == 0) return 0; int msb = 0; n = n / 2; while (n != 0) { n = n / 2; msb++; } return (1ll << msb); } int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } // // Function to return LCM of two numbers // long long lcm(ll a, ll b) // { // return (a / gcd(a, b)) * b; // } // void dfs(int node){ // vis[node]=1; // // val[node]=0; // for(auto it:adj[node]){ // int b= it.first,d=it.second; // if(!vis[b]){ // val[b]=val[node]+d; // dfs(b); // } // } // } int findGCD(vector<int> &arr, int n) { int result = arr[0]; for (int i = 1; i < n; i++) { result = gcd(arr[i], result); if(result == 1) { return 1; } } return result; } // bool comp(int a, int b) // { // return (a < b); // } bool comp(const pair<pt, int>& a, const pair<pt, int>& b) { if (a.first.ff != b.first.ff) return (a.first.ff < b.first.ff); else return (a.ff.second > b.ff.second); } int findlcm(vector<int> &arr, int n) { // Initialize result // vector<int> ans(n); int ans = arr[0]; // ans contains LCM of arr[0], ..arr[i] // after i'th iteration, for (int i = 1; i < n; i++) ans = (((arr[i] * ans)) / (gcd(arr[i], ans))); return ans; } vector<int> findlcm1(vector<int> &arr, int n) { // Initialize result vector<int> ans(n); ans[0] = arr[0]; // ans contains LCM of arr[0], ..arr[i] // after i'th iteration, for (int i = 1; i < n; i++) ans[i] = (((arr[i] * ans[i-1])) / (gcd(arr[i], ans[i-1]))); return ans; } int mex(vector<int> &arr, int N) { // sort the array sort(arr.begin(), arr.end()); int mex = 0; for (int idx = 0; idx < N; idx++) { if (arr[idx] == mex) { // Increment mex mex += 1; } } // Return mex as answer return mex; } // int dfs(int node,vi & vis,vector<vi> &adj){ // vis[node]=1; // int size=1; // for(int it:adj[node]){ // if(!vis[it]){ // size+=dfs(it,vis,adj); // } // } // return size; // } // Function to perform DFS and check for cycle bool dfs(int node, vector<vector<int>>& adj, vector<bool>& visited, vector<bool>& recStack) { // Mark the current node as visited and part of the recursion stack visited[node] = true; recStack[node] = true; // Recur for all the vertices adjacent to this vertex for (int neighbor : adj[node]) { // If the adjacent node is not visited, then recur on it if (!visited[neighbor] && dfs(neighbor, adj, visited, recStack)) { return true; } // If an adjacent node is visited and in the recursion stack, then there is a cycle else if (recStack[neighbor]) { return true; } } // Remove the node from the recursion stack recStack[node] = false; return false; } // Function to detect a cycle in a directed graph bool hasCycle(int V, vector<vector<int>>& adj) { vector<bool> visited(V, false); vector<bool> recStack(V, false); // Call the recursive helper function to detect cycle in different DFS trees for (int i = 0; i < V; i++) { if (!visited[i] && dfs(i, adj, visited, recStack)) { return true; } } return false; } int modcal(int n,int k){ int ans=n; for(int i=0;i<k-1;i++){ ans=(ans*n)%mod; } return ans; } int getSum(int n) { int sum = 0; while (n != 0) { sum = sum + n % 10; n = n / 10; } return sum; } int countFreq(string& pat, string& txt) { int M = pat.length(); int N = txt.length(); int res = 0; /* A loop to slide pat[] one by one */ for (int i = 0; i <= N - M; i++) { /* For current index i, check for pattern match */ int j; for (j = 0; j < M; j++) if (txt[i + j] != pat[j]) break; // if pat[0...M-1] = txt[i, i+1, ...i+M-1] if (j == M) { res++; } } return res; } int rangeBitwiseOr(int a, int b) { // If a is equal to b, the OR result is just a (or b) if (a == b) { return a; } // Initialize result to 0 int result = 0; // Iterate over bits from most significant to least significant for (int bit = 31; bit >= 0; --bit) { // Check if a and b have different bits at the current position if ((a & (1 << bit)) != (b & (1 << bit))) { // If they differ, set all bits to the right to 1 result = (1 << (bit + 1)) - 1; break; } } // OR result with a to include higher significant bits from a result |= a; // OR result with b to include higher significant bits from b result |= b; return result; } // [1,3,6,1,2,1] int Zeroes(int n) { int count = 0; while (n % 10 == 0) { count++; n /= 10; } return count; } int Digits(int n) { int count = 0; while (n != 0) { n /= 10; ++count; } return count; } class Solution { private: bool checkCycle(int node, vector < int > adj[], int vis[], int dfsVis[]) { vis[node] = 1; dfsVis[node] = 1; for (auto it: adj[node]) { if (!vis[it]) { if (checkCycle(it, adj, vis, dfsVis)) return true; } else if (dfsVis[it]) { return true; } } dfsVis[node] = 0; return false; } public: bool isCyclic(int N, vector < int > adj[]) { int vis[N], dfsVis[N]; for(int i = 0; i < N; i++){ vis[i] = 0; dfsVis[i] = 0; } for (int i = 0; i < N; i++) { if (!vis[i]) { // cout << i << endl; if (checkCycle(i, adj, vis, dfsVis)) { // cout << i << endl; return true; } } } return false; } }; void addEdge(vector < int > adj[], int u, int v) { adj[u].push_back(v); } int pow_mod(int x, int p,int p1) { if (p == 0) { return 1; } if (p % 2 == 0) { int y = pow_mod(x, p / 2,p1); return (y * y) % p1; } return (x * pow_mod(x, p - 1,p1)) % p1; } int inv(int x,int p,int p1) { return pow_mod(x, p - 2,p1); } // vector<int> fact = {1}; int cnk(int n, int k,int p) { int res = fact[n]; res = (res * rev[k]) % p; res = (res * rev[n-k]) % p; return res; } vector<int>Zfunc(string& str){ int n=str.size(); vector<int>z(n); int l=0,r=0; for(int i=1;i<n;i++){ if(i<=r){ z[i]=min(r-i+1,z[i-l]); } while(i+z[i]<n&&str[z[i]]==str[i+z[i]]){ z[i]++; } if(i+z[i]-1>r){ l=i; r=i+z[i]-1; } } return z; } int check(vector<int>&z,int len){ int n=z.size(); int cnt=1; for(int i=len;i<n;){ if(z[i]>=len){ cnt++; i+=len; }else{ i++; } } return cnt; } int query(int u,int v){ u++,v++; cout<<"? "<<u<<" "<<v<<endl; cout.flush(); int x; cin>>x; x--; return x; } int floorSqrt(int n) { if (n == 0 || n == 1) { return n; // The square root of 0 or 1 is itself } int start = 1, end = n, result = 0; while (start <= end) { int mid = start + (end - start) / 2; // Calculate mid point to prevent overflow // Check if mid*mid is equal to n if (mid <= n / mid) { // Equivalent to mid * mid <= n to avoid overflow result = mid; // Update the result start = mid + 1; // Look for a larger value } else { end = mid - 1; // Look for a smaller value } } return result; } // struct Compare { // bool operator()(const std::array<int, 3>& a, const std::array<int, 3>& b) const { // // Compare lexicographically (order-wise) // if (a[0] != b[0]) // return a[0] < b[0]; // Compare the first elements // else if (a[1] != b[1]) // return a[1] < b[1]; // Compare the second elements // else // return a[2] < b[2]; // Compare the third elements // } // }; // prime no 1,299,827 for hash // mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count()); int rndsum(vi & a,int k,int cnt){ int n=a.size()-1; // if(cnt==0) return 0; if(k+cnt<=n+1){ return a[cnt+k-1]-a[k-1]; } else{ return a[n]-a[k-1]+a[cnt-(n-k+1)]; } } void dfs(int u,vector<vector<pt>> &adj,vi &vis,vi &ans){ vis[u]=1; for(auto it:adj[u]){ int v=it.ff; int w=it.ss; if(!vis[v]){ vis[v]=1; ans[v]=ans[u]+w; dfs(v,adj,vis,ans); } } } int digit(int a, int b) { return a / ((int)pow(10, b - 1)) % 10; } void solve(){ int n; cin>>n; vi a(51,0); int ans=0; rep(i,n) { int x; cin>>x; a[x]++; ans=max(ans,a[x]); } cout<<n-ans<<endl; // cout<<ans<<endl; } signed main() { // Write C++ code here ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ solve(); } // cout << log2(RNG()) << endl; // return 0; }
2031A
right_submission
291,577,066
C++20 (GCC 13-64)
OK
/** * author: tourist * created: 15.11.2024 04:35:20 **/ #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt; cin >> tt; while (tt--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } map<int, int> freq; int mx = 0; for (int x : a) { freq[x] += 1; mx = max(mx, freq[x]); } cout << n - mx << '\n'; } return 0; }
2031A
right_submission
293,196,579
C++23 (GCC 14-64, msys2)
OK
#include <bits/stdc++.h> using i64 = long long; using u64 = unsigned long long; using u32 = unsigned; using u128 = unsigned __int128; void solve() { int n; std::cin >> n; std::vector<int> h(n); for (int i = 0; i < n; i++) { std::cin >> h[i]; } int ans = 0; for (int l = 0, r = 0; l < n; l = r) { while (r < n && h[l] == h[r]) { r++; } ans = std::max(ans, r - l); } ans = n - ans; std::cout << ans << "\n"; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; std::cin >> t; while (t--) { solve(); } return 0; }
2031A
right_submission
291,583,500
C++23 (GCC 14-64, msys2)
OK
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> typedef long long ll; typedef long double ld; typedef unsigned long long ull; #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define all(vec) vec.rbegin(), vec.rend() #define cin(v) for (auto& i : v) cin >> i #define cout(v) for (auto& i : v) cout << i << ' '; cout << "\n" #define Ceil(a, b) ((a / b) + (a % b ? 1 : 0)) #define MOD 1000000007 #define fr first #define sc second using namespace __gnu_pbds; using namespace std; void initialize_io() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif } void solve(){ ll n; cin >> n; vector <ll> v(n); map <ll, ll> mp; for (auto&i : v){ cin >> i; mp[i]++; } ll mx = 0; for (auto&[_, i]:mp){ mx = max(mx, i); } cout << n - mx << "\n"; } int main(){ initialize_io(); int T = 1; cin >> T; while (T--){ solve(); } return 0; }
2031A
right_submission
291,601,945
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <iostream> using namespace std; int f[51]; int main() { int t,i,n,j,a,x; cin >> t; for (i=0; i<t; i++){ cin >> n; x=0; for (j=0; j<n; j++){ cin >> a; f[a]++; x=max(x, f[a]); } cout << n-x << '\n'; for (j=0; j<n; j++) f[j]=0; } return 0; }
2031A
wrong_submission
302,464,193
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <iostream> using namespace std; int main() { int t; cin>>t; for (int i=0;i<t;i++) { int n; cin>>n; int h[n]; for (int j=0;j<n;j++) { cin>>h[j]; } if(n==1) cout<<0<<endl; else if(n==2) cout<<1<<endl; else if (h[n/2]==h[n/2+1]==h[n/2-1]) cout<<n-3<<endl; else if ((h[n/2]==h[n/2+1])||(h[n/2]==h[n/2-1])) cout<<n-2<<endl; else cout<<n-1<<endl; } return 0; }
2031A
wrong_submission
302,696,674
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <iostream> using namespace std; int main (){ int t; cin >> t; while (t--) { int n; cin >> n; int a[n + 1]; a[0] = -1; int x = 1; int y = 1; for (int i = 1; i <= n; i++) { cin >> a[i]; if (a[i] == a[i - 1]) { y++; if (y > x) x = y; } } cout << n - x << endl; } }
2031A
wrong_submission
297,238,572
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<iostream> #include<vector> #include<map> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; vector<int> arr(n); for (int i=0; i< n; i++){ cin>>arr[i]; } map<int, int> mp; for (int i=0; i< n; i++){ mp[arr[i]]++; } map<int, int>::iterator it; int c=0; for (it= mp.begin(); it!= mp.end(); it++){ if (it->second!=1){ cout<<n-it->second<<'\n'; break; } else { c++; } } if (c==n){ cout<<n-1<<'\n'; } } return 0; }
2031A
wrong_submission
291,596,466
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <string> #include <algorithm> #include <iostream> int main() { int t; std::cin >> t; while (t--) { int n; std::cin >> n; int max = 0; int prev; std::cin >> prev; int cnt = 1; for (int i = 1; i < n; i++) { int a; std::cin >> a; if (a == prev) { cnt++; } else { if (max < cnt) { max = cnt; cnt = 0; } } } if (cnt > max) { max = cnt; } std::cout << n - max << '\n'; } return 0; }
2031A
wrong_submission
291,691,086
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <iostream> using namespace std ; int main() { int t ; cin >> t ; while(t--){ int n ; cin >> n ; int arr[n] , hash[n] = {0} ; for(int i = 0 ; i < n ; i++){ cin >> arr[i] ; hash[arr[i]]++ ; } int maxi = 1 ; for(int i = 0 ; i < n ; i++) maxi = max(maxi,hash[i]) ; cout << n-maxi << endl ; } return 0; }
2031A
wrong_submission
293,181,607
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include<queue> #include<iostream> using namespace std; #define lld long long int int main(){ long long int testCase,testNum,tempNum,cnt=0; cin>>testCase; for (long long int i = 0; i < testCase; i++) { cin>>testNum; priority_queue<int> queue; cnt=0; for (lld j = 0; j < testNum; j++) { cin>>tempNum; if (!queue.empty() && queue.top() > tempNum) { cnt++; } queue.push(tempNum); } cout<<cnt<<endl; } return 0; }
2031A
wrong_submission
291,604,408
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <iostream> #include <vector> #include <algorithm> #include <unordered_set> #include <string> #include <queue> #include <map> #include <cmath> #include <set> #include <fstream> #define int long long using namespace std; signed main() { int t; cin>>t; while (t--){ int n; cin>>n; vector<int> vec(n); for (int i = 0; i < n; i++) cin>>vec[i]; int result = 0; for (int i = 0; i < n - 1; i++){ if (vec[i] > vec[i + 1]){ vec[i] = vec[i + 1]; result++; } } cout<<result<<'\n'; } }
2031A
wrong_submission
291,638,191
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include<iostream> #include<algorithm> using namespace std; const int N = 2e5 + 7; const int fill = 1e6; #define ll long long int a[N]; void solve() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; int inc = 0, dec = 0; for (int i = 1; i < n; i++) { if (a[i] > a[i - 1]) inc++; } for (int i = 1; i < n; i++) { if (a[i] < a[i - 1]) dec++; } if (dec == 0 ) cout << 0 << '\n'; else if (inc == 0) cout << dec << '\n'; else cout << min(dec, inc)<<'\n'; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { solve(); } return 0; }
2031A
wrong_submission
291,613,792
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #include<string> using namespace std; #define int long long #define vi vector<long long> #define pb push_back #define pp pop_back #define all(x) x.begin(),x.end() using ll=long long; const char nl = '\n'; int min_operations(vector<int>& heights) { int changes = 0; int n = heights.size(); for (int i = 0; i < n - 1; ++i) { if (heights[i] > heights[i + 1]) { changes++; } } return changes; } signed main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> heights(n); for (int i = 0; i < n; ++i) { cin >> heights[i]; } cout << min_operations(heights) << endl; } return 0; }
2031A
wrong_submission
302,557,617
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <iostream> #include <vector> using namespace std; void solve() { int t; cin >> t; // Number of test cases while (t--) { int n; cin >> n; // Number of pillars vector<int> h(n); // Input the heights for (int i = 0; i < n; i++) { cin >> h[i]; } // Count the number of operations int operations = 0; for (int i = 0; i < n - 1; i++) { if (h[i] > h[i + 1]) { operations++; // Increment operation count for each adjustment } } // Output the result for the test case cout << operations << endl; } } int main() { ios::sync_with_stdio(false); cin.tie(0); solve(); return 0; }
2031A
wrong_submission
291,587,125
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#define _CRT_SECURE_NO_WARNINGS #include <math.h> #include <bitset> #include <numeric> #include <iostream> #include <vector> #include <string> #include <stack> #include <map> #include <set> #include <queue> #include <deque> #include <iomanip> #include <math.h> #include <algorithm> #include <list> #include <fstream> #include <stdio.h> #include <list> #include <forward_list> #include <unordered_set> #include <unordered_map> #include <random> #pragma warning(disable : 4996) typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef std::vector<int> vi; typedef std::vector<ll> vll; typedef std::vector<std::vector<int>> vvi; typedef std::vector<std::vector<ll>> vvll; typedef std::vector<std::pair<int, int>> vii; typedef std::pair<int, int> ii; typedef std::pair<ll, ll> llll; using namespace std; #define sort(a) std::sort(a.begin(), a.end()) #define str(a) std::to_string(a) #define all(a) a.begin(), a.end() const int inf = 1e9 + 10; template <typename Ty> istream& operator>>(istream& is, vector<Ty>& a) { for (int i = 0; i < a.size(); i++) is >> a[i]; return is; } template <typename Ty> ostream& operator<<(ostream& os, vector<Ty> a) { os << "\n"; for (int i = 0; i < a.size(); i++) os << a[i] << " "; return os; } template <typename Ty> ostream& operator<<(ostream& os, pair<Ty, Ty> a) { os << a.first << ", " << a.second << " "; return os; } template <typename Ty> istream& operator>>(istream& os, pair<Ty, Ty>& a) { os >> a.first >> a.second; return os; } template <typename Ty> ld log(Ty a, Ty b) { ld ans = 0; ans = log2(a); ans /= log2(b); return ans; } template<size_t T> bitset<T> operator& (bitset<T> b, int a) { return b & bitset<T>(a); } string answer = ""; void solve() { ll n; cin >> n; vll a(n); cin >> a; ll ans1 = 0, ans2 = 0; ll max = a[0]; for (int i = 0; i < n; i++) { if (a[i] < max) ans1++; max = std::max(max, a[i]); } for (int i = n - 1; i >= 0; i--) { if (a[i] > max) ans2++; max = std::min(max, a[i]); } answer += str(std::min(ans1, ans2)) + "\n"; } int main() { int t = 1; cin >> t; while (t--) solve(); cout << answer << "\n"; return 0; }
2031A
wrong_submission
291,577,952
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
// Problem: A. Пенчик и современная статуя // Contest: Codeforces - Codeforces Round 987 (Div. 2) // URL: https://codeforces.com/contest/2031/problem/0 // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org) //#include <bits/stdc++.h> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #include <cassert> #define int long long #define rev reverse #define ent '\n' #define in insert #define no "NO" #define yes "YES" #define sz size #define pii pair<int,int> #define pic pair<int,char> #define pis pair<int,string> #define pcc pair<char,char> #define pci pair<char,int> #define pcs pair<char,string> #define pss pair<string,string> #define psi pair<string,int> #define psc pair<string,char> #define pf push_front #define pb push_back #define inf INT_MAX #define F first #define S second #define con continue #define ret return #define all(x) x.begin(),x.end() #define sayat_abi_crush_228 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; int gcd(int a, int b){ while(a>0 and b>0){ if (a>b) swap(a,b); b%=a;}return a;} struct triad {int a,b,c; triad(int x,int y,int z):a(x),b(y),c(z){}}; bool cmp(pii a, pii b){ if (a.F==b.F){ return a.S<b.S; } return a.F<b.F; } int binpow(int x,int n){ if (n==0) return 1; if (n%2==1) return (binpow(x,n-1)*x); else { int a=(binpow(x,n/2)); return (a*a); } } const int maxn=1e5+5,MOD=1e9+7; void sayat_abi_sigma_228(){ int n,ans=0; cin >> n; int a[n+5]; for (int i=1; i<=n; i++){ cin >> a[i]; } for (int i=1; i<n; i++){ if (a[i]==a[i+1]) con; ans++; } cout << ans << ent; } signed main(){ //freopen("slalom.in" , "r" , stdin); //freopen("slalom.out" , "w" , stdout); int t=1; sayat_abi_crush_228 cin>>t; for(int i = 1;i <= t;i++){ //cout<<"Scenario #"<<i<<": "; sayat_abi_sigma_228(); } }
2031A
wrong_submission
291,578,890
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define all(x) x.begin(), x.end() #define pb push_back #define pii pair<int, int> #define F first #define S second #define watch(x) cout << (#x) << ':' << (x) << '\n'; template<typename T> // print vector ostream& operator<<(ostream& os, const vector<T>& v){ for (auto &x : v) os << x << ' '; return os; } void orz() { int n; cin >> n; vector<int> v(n); for (auto &x : v) cin >> x; int cnt = 0; for (int i = 1; i < n; i++){ if (v[i] < v[i-1]) cnt++; } cout << cnt << '\n'; } int32_t main() { ios::sync_with_stdio(false), cin.tie(nullptr); cin.exceptions(cin.failbit); int t; cin >> t; while (t--) orz(); return 0; }
2031A
wrong_submission
291,615,646
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include<iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; if (n == 1) { cout << 0 << endl; continue; } int ans; int res = 0; cin >> ans; for (int i = 1; i < n; i++) { int m; cin >> m; if (ans > m) { res++; continue; } if (ans < m) ans = m; } cout << res << endl; } return 0; }
2031A
wrong_submission
291,617,790
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #define sz(s) (int)s.size() #define all(v) (v.begin(),v.end()) #define ll long long #define gcd __gcd #define endl "\n" using namespace std; void Tosy(){ ///freopen("output.txt",'w',stdout); ///freopen("input.txt",'r',stdin); ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); } const int MOD=1e9+7; int dx[]={0,0,1,-1,1,-1,1,-1}; int dy[]={1,-1,0,0,-1,1,1,-1}; int main() { int t;cin>>t; while(t--){ int n;cin>>n; vector<int>v(n); for(int i=0;i<n;++i)cin>>v[i]; int ans=0; for(int i=1;i<n;++i) if(v[i]<v[i-1]) ans++,v[i]=v[i-1]; cout<<ans<<endl; } return 0; }
2031A
wrong_submission
291,663,402
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; typedef long long ll; void fast_io() { ios::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int t; cin >> t; while(t--){ int a; cin >> a; vector<int> v(a); for (int i = 0; i < a; i++) { cin >> v[i]; } int count = 0; for (int i = 0; i < v.size() - 1; i++) { if (v[i] > v[i + 1]) { count++; } } cout << count << endl; } return 0; }
2031A
wrong_submission
291,633,911
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include <iostream> #include <vector> #include <climits> using namespace std; int mins(int n, vector<int>& h) { int maxs = INT_MAX; int ops = 0; for (int i = n - 1; i >= 0; --i) { if (h[i] > maxs) { ops++; maxs = h[i]; } else { maxs = min(maxs, h[i]); } } return ops; } int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> h(n); for (int i = 0; i < n; ++i) { cin >> h[i]; } cout << mins(n, h) << endl; } return 0; }
2031A
wrong_submission
291,582,723
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
/** * author: feev1x * created: 15.11.2024 18:36:26 **/ #include <bits/stdc++.h> using i64 = long long; int main() { int tt; scanf("%d", &tt); while (tt--) { int n; scanf("%d", &n); std::vector<int> a(n); for (auto &u: a) { scanf("%d", &u); } std::vector<std::pair<int, int>> v; for (int i = 0; i < n; ++i) { if (v.empty() || v.back().first != a[i]) { v.emplace_back(a[i], 1); } else { int cnt = v.back().second; v.pop_back(); v.emplace_back(a[i], cnt + 1); } } int res = 0; for (int i = 1; i < v.size(); ++i) { res += std::min(v[i - 1].second, v[i].second); } printf("%d\n", res); } return 0; }
2031A
wrong_submission
295,953,745
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define f(i, n) for (ll i = 0; i < n; i++) #define f1(i, n) for (ll i = 1; i <= n; i++) #define rf(i, n) for (ll i = n-1; i >= 0; i--) #define rep(i, j, n) for (ll i = j; i < n; i++) #define ll long long #define vi vector<ll> #define vp vector<pair<ll,ll>> #define pb push_back #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define fi first #define se second #define print(arr) for(auto it: arr){cout<<it<<" ";} cout<<endl; #define input(arr, n) for(ll i = 0; i < n; i++) { ll t = 0; cin >> t; arr.push_back(t); } #define make_vp(arr, n) for(ll i = 0; i < n; i++) { ll t = 0; cin >> t; arr.push_back(make_pair(t,i));} #define input_vp(A,n) for(ll i=0;i<n;i++){ pair<ll,ll> p;cin>>p.first>>p.second; A.push_back(p);} #define input_arr(A, n) for(ll i = 0; i < n; i++) { cin >> A[i]; } #define input_matrix(A, n, m) for(ll i = 0; i < n; i++) { for(ll j = 0; j < m; j++){cin >> A[i][j]; }} #define print_arr(A, n) for(ll i = 0; i < n; i++){cout<<A[i]<<" ";} cout<<endl; #define yes cout << "YES\n" #define no cout << "NO\n" #define neg cout << "-1\n" #define zero cout << "0\n" #define maximum(arr) *max_element(arr.begin(),arr.end()); #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define powll(x, y) static_cast<ll>(pow(x, y)) #define is_prime(n) ([](ll x){return x>1&&(x<=3||!(x%2==0||x%3==0)&&([](ll n){for(ll i=5;i*i<=n;i+=6)if(n%i==0||n%(i+2)==0)return 0;return 1;})(x));})(n) using namespace std; void solve() { ll n, i,count=0; cin >> n; vi A; input(A, n) f(i,n-1) { if(A[i+1]<A[i]) count++; } cout<<count<<endl; } int main() { fastio; ll t=1; cin >> t; while(t--) solve(); return 0; }
2031A
wrong_submission
291,629,239
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int main () { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> arr(n); for (int i=0; i<n; i++) { cin >> arr[i]; } int res = 0; for (int i=0; i<n-1; i++) { if (arr[i] > arr[i+1]) { res++; arr[i] = arr[i+1]; } } cout << res << endl; } return 0; }
2031A
wrong_submission
291,676,064
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ int n; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } int c=0; if(n==1){ cout<<c<<endl; } else{ for(int i=0;i<n-1;i++){ if(a[i]>a[i+1]){ c++; } } cout<<c<<endl; } }}
2031A
wrong_submission
291,625,732
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define VI vector<int> #define VII vector<vector<int>> #define PI pair<int,int> #define PII vector<pair<int,int>> #define MI map<int,int> #define MII map<int,map<int,int>> #define SI set<int> #define endl '\n' using ll=long long; using namespace std; void solve() { int n; cin>>n; VI a(n); int cnt=0; for(int i=0;i<n;i++) cin>>a[i]; if(n==1) { cout<<"0"<<endl; return ; } else { int p=0,q=0; for(int i=0;i<n-1;i++) { if(a[i]==a[i+1]) { // cout<<a[i]<<"*"<<endl; p++; } if(a[i]<a[i+1]) { p=0; } if(a[i]>a[i+1]) { cnt++; for(int j=i+1;j<n-1;j++) { if(a[j]==a[j+1]&&(j+1)==(n-1)) { q++; // cout<<p<<" "<<q<<endl; cnt+=min(p,q); p=0,q=0; break; } if(a[j]==a[j+1]) { q++; i=j; } else { //cout<<p<<" "<<q<<endl; cnt+=min(p,q); p=0,q=0; break; } } } } } cout<<cnt<<endl; return ; } signed main() { IOS; int t; cin>>t; while(t--) { solve(); } return 0; }
2031A
wrong_submission
291,589,091
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define HABIBA ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define F first #define S second #define LL long long #define lp \ int _ = 1; \ cin >> _; \ while (_--) #define sorting sort(a, a + n); #define pb(X) push_back(X); #define all(X) X.begin(), X.end() const LL MOD = 1e9 + 7; const int N = 1e4 + 5; using namespace __gnu_pbds; using namespace std; int dx[8] = {0, 0, -1, 1, 1, 1, -1, -1}; int dy[8] = {1, -1, 0, 0, -1, 1, -1, 1}; #pragma GCC optimize("-Ofast") #pragma GCC optimize("-O1") template <class T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; int l_bound(vector<pair<int, int>>& a, LL x) { int l = 0, r = a.size(), md = 0, ans = -1; while (l <= r) { md = (l + r) / 2; if (a[md].F > x) r = md - 1; else l = md + 1, ans = md; } return ans; } void cat() { LL n, k; cin >> n ; int a[n], b[n]; for (int i=0; i<n;i++){ cin >>a[i]; b[i]=a[i]; } int x=0, y=0; for (int i=1; i<n;i++){ if (a[i]<a[i-1]){ x++; a[i]=a[i-1]; } } for (int i=n-2; i>=0;i--){ if (b[i]>b[i+1]){ y++; b[i]=b[i+1]; } } cout <<min(x,y)<<"\n"; } int main() { HABIBA lp { cat(); } return 0; } /*█▀▀▄░░░░░░░░░░░▄▀▀█ ░█░░░▀▄░▄▄▄▄▄░▄▀░░░█ ░░▀▄░░░▀░░░░░▀░░░▄▀ ░░░░▌░▄▄░░░▄▄░▐▀▀ ░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█ ░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█ ▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█ █░░░▀▄░█░░░█░▄▀░░░░█▀▀▀ ░▀▄░░▀░░▀▀▀░░▀░░░▄█▀ ░░░█░░░░░░░░░░░▄▀▄░▀▄ ░░░█░░░░░░░░░▄▀█░░█░░█ ░░░█░░░░░░░░░░░█▄█░░▄▀ ░░░█░░░░░░░░░░░████▀ ░░░▀█▄▄▄▀▀▀▀▄▄▄█▀ */
2031A
wrong_submission
302,269,175
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; #define int long long int mod=1e9+7; bool cmp(pair<int,int> a ,pair<int,int>b){ return a.second<b.second; } int modPow(int base, int exponent, int mod) { int result = 1; base = base % mod; while (exponent > 0) { if (exponent % 2 == 1) { result = (result * base) % mod; } base = (base * base) % mod; exponent /= 2; } return result; } // Function to calculate modular inverse int modInverse(int Q, int mod) { return modPow(Q, mod - 2, mod); } bool prime(int n){ if(n==2) return true; if(n<=1) return false; for(int i=3;i<=sqrt(n);++i){ if(n%i==0){ return false; } } return true; } void solve(){ int n; cin>>n; vector<int>a(n); for(int i=0;i<n;++i){ cin>>a[i]; } int ans=0; int temp=min(a[0],a[1]); for(int i=0;i<n-1;++i){ if(a[i]>a[i+1]){ ans+=1; a[i]=temp; a[i+1]=temp; } } cout<<ans<<endl; } signed main() { int t; cin>>t; while(t--){ solve(); } }
2031A
wrong_submission
291,577,464
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include<iostream> #include<vector> #include<string.h> #include<set> #include<algorithm> #include<string> #include<cstring> #include<unordered_map> #include<map> #include<queue> #include<stack> #include<cmath> #include<fstream> #include<ctime> #include<array> #include<bitset> #include<iomanip> #include <stdlib.h> #include <tuple> #include <chrono> #include <random> #include<stdio.h> #include <numeric> using namespace std; std::mt19937_64 rnd(time(0)); //#define MAXN 400000 #define MOD 998244353 #define eps 1e-6 #define ll long long #define ull unsigned long long const ll inf = 0x3f3f3f3f; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int tt=1; cin >> tt; while (tt--) { int n; cin >> n; int last = 0x3f3f3f3f3f; int tmp = 0; int res = n - 1; for (int i = 0; i < n; ++i) { cin >> tmp; if (tmp == last) --res; last = tmp; } cout << res << endl; } }
2031A
wrong_submission
291,580,395
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; #define int long long #define ld long double constexpr int INF = 2e18; constexpr int MOD = 1e9 + 7; #define all(x) begin(x), end(x) #define Sort(x) sort(all(x)) #define rev_sort(x) sort(all(x), greater<int>()) void solve() { int n; cin >> n; vector<int> h(n); for(auto& i : h) cin >> i; int x = h[0], ans = 0; for(auto i : h) if(i != x) ++ans; cout << ans << '\n'; } int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0); cout << setprecision(12) << fixed; // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); int tests = 1; cin >> tests; for (int tt = 1; tt <= tests; ++tt){ // cout << "Test " << tt << " :\n"; solve(); } return 0; }
2031A
wrong_submission
291,834,860
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
/* _ _ _ __ _ _ ___ |__ __ _ | | | |/ / | | | | / __| | '_ \ / _` | | | | < | |_| | \__ \ | | | | | (_| | | | |_|\_\ \__,_| |___/ |_| |_| \__,_| |_| */ #include<iostream> #include<vector> #include<map> #include<algorithm> #include<string> #include <bits/stdc++.h> #include<queue> #include<stack> #include<set> #include<bitset> using namespace std; #define vi vector<int> v #define vl vector<ll> v #define mii map<int,int> #define py cout<<"YES"<<endl #define pn cout<<"NO"<<endl #define ll long long #define arrange sort(v.begin(),v.end()) #define debugpy cout<<"-------------------------Y--------"<<endl #define debugpn cout<<"-------------------------N--------"<<endl #define debugans cout<<"ANSWER ==>>>>>>>>>>>>>>>>>>>"<<ans<<endl #define pb push_back #define all(x) x.begin(),x.end() ////////////////#####################INPUT###############/////////////////////// template <typename T> void read(T &p){ cin>>p; } template <typename T, typename T1> void read(pair<T, T1> &p) { read(p.ff); read(p.ss); } template <typename T> void read(T arr[], ll n) { for (ll i = 0; i < n; i++) { read(arr[i]); } } template <typename T> void read(vector<T> &arr) { for (ll i = 0; i < arr.size(); i++) { read(arr[i]); } } //######################################################################### using namespace std; string alphabet = "abcdefghijklmnopqrstuvwxyz"; ll gcd(ll a,ll b){ if(a==0){ return b; } return gcd(b%a,a); } bool even(int a){ return (a%2==0); } bool even(ll a){ return (a%2==0); } bool odd(int a){ return (a%2!=0); } bool odd(ll a){ return (a%2!=0); } ll min(ll a,ll b){ if(a<b){ return a; } else{ return b; } } ll max(ll a,ll b){ if(a>b){ return a; } else{ return b; } } template <typename T> vector<T> factors(T x){ vector<T> ans; for(int i=2;i<=sqrt(x);i++){ if(x%i==0){ ans.pb(i); ans.pb(x/i); } } return ans; } void kushal(){ int n; cin>>n; vector<int> v(n); read(v); int ans = 0; for(int i=0;i<n-1;i++){ if(v[i] > v[i+1]){ ans++; v[i+1] = v[i]; } } cout<<ans<<endl; } int main(){ // fast inputs ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t=1; cin>>t; while(t--){ kushal(); } return 0; }
2031A
wrong_submission
291,585,564
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define rep(i,a,n) for(int i=a;i<=n;i++) #define all(p) p.begin(),p.end() #define int long long using namespace std; void solve() { int n; cin >> n; vector<int> h(n + 1); rep(i, 1, n) cin >> h[i]; int mx = h[1],mi=h[n], cnt1 = 0, cnt2=0; rep(i, 2, n) { if (h[i] < mx) cnt1++; mx = max(h[i], mx); } for (int i = n - 1; i >= 1; i--) { if (h[i] > mi) cnt2++; mi = min(mi, h[i]); } cout << min(cnt1,cnt2) << '\n'; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t = 1; cin >> t; while (t--) { solve(); } return 0; }
2031A
wrong_submission
291,580,806
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
// problem statement: #include <bits/stdc++.h> using namespace std; constexpr int MAXN = 50 + 10; int T, n; int a[MAXN]; int main() { ios::sync_with_stdio(false); cin >> T; while (T--) { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } int ans = 0; for (int i = 2; i <= n; i++) { if (a[i] != a[1]) { ans++; } } cout << ans << '\n'; } return 0; }
2031A
wrong_submission
291,600,101
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int t,n; int a[1000]; void solve(){ int all = 0; cin >> n; for(int i = 1; i <= n ; i++){ cin >> a[i]; } for(int i = 1; i<n;i++){ if(a[i+1] < a[i]){ a[i+1] = a[i]; all++; } else{ continue; } } cout << all << endl; } int main(){ cin >> t; while(t--){ solve(); } return 0; }
2031A
wrong_submission
291,613,300
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); for (auto &x : a) { cin >> x; } int ans = 0; for (int i = 0; i < n - 1; i++) { if (a[i] > a[i + 1]) { ans = n - i - 1; break; } } cout << ans << "\n"; } }
2031A
wrong_submission
291,600,289
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define ll long long int #define ld long double #define vi vector<int> #define vll vector<ll> #define vb vector<bool> #define vvi vector<vector<int>> #define vvb vector<vector<bool>> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define endl '\n' using namespace std; const long double PI = acos(-1); const ll mod = 1e9 + 7; // 10^9 + 7 #define INF 1000000000 // Infinity value template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; // set a = min(a,b) } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; // set a = max(a,b) } template<class T> vector<pair<T,int>> factor(T x) { vector<pair<T,int>> pri; for (T i = 2; i*i <= x; ++i) if (x % i == 0) { int t = 0; while (x % i == 0) x /= i, t ++; pri.push_back({i,t}); // i --> factor of x } if (x > 1) pri.push_back({x,1}); return pri; } void setIO(string s) { // the argument is the filename without the extension freopen((s+".in").c_str(),"r",stdin); freopen((s+".out").c_str(),"w",stdout); } //predefined functions int power(ll x, ll y, ll m); // (x^y)%m void solve() { ll n, maxNum = 0; cin >> n; vll vc(n); for(ll i=0;i<n;i++){ cin >> vc[i]; } ll count = 0; for(ll i=0;i<n-1;i++){ if(vc[i]<=vc[i+1]) continue; if(vc[i]>=vc[i+1]){ vc[i+1] = vc[i]; count++; } } cout << count << endl; } int power(ll x, ll y, ll m){ // (x^y)%m ll res = 1; x = x%m; while(y>0){ if(y&1) res = (res*x)%m; y = y/2; x = (x*x)%m; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("error.txt", "w", stderr); freopen("output.txt", "w", stdout); #endif int t=1; cin>>t; while(t--) { solve(); } // solve(); #ifndef ONLINE_JUDGE cerr<<"Executed In: "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl; #endif return 0; }
2031A
wrong_submission
291,612,562
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; #define endl '\n' #define int long long const int MOD = 1e9+7; const int INF = LONG_MAX >> 1; signed main() { ios::sync_with_stdio(false); cin.tie(NULL); int tc; cin >> tc; while (tc--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int cnt = 1; for (int i = 1; i < n; i++) { if (a[i] == a[i-1]) { cnt++; } } int result=n; result=n-cnt; if (cnt == n) { cout << 0 << endl; continue; } else { cout<<result<<endl; } } }
2031A
wrong_submission
291,641,453
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#pragma GCC optimize(O2) #include<bits/stdc++.h> #define int long long using namespace std; void solve(){ //<= int n;cin>>n; if(n==1){ cout<<0<<"\n"; return; } vector<int>b(n+1); for(int i=1;i<=n;i++) cin>>b[i]; int ans=1e18; for(int i=1;i<n;i++){ int t=0; auto a=b; for(int j=i-1;j>=1;j--){ if(a[j]>a[i]){ a[j]=a[i];t++;} else if(a[j]>a[j+1]){ a[j]=a[j+1]; t++; } } for(int j=i+1;j<=n;j++){ if(a[j-1]>a[j]){ a[j]=a[j-1]; t++; } } ans=min(ans,t); } cout<<ans<<"\n"; } signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr); int T=1; cin>>T; while(T--){ solve(); } return 0; }
2031A
wrong_submission
291,639,281
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ int n; cin>>n; vector<int>vec; for(int i=0;i<n;i++){ int x; cin>>x; vec.push_back(x); } if(n==1){ cout<<0<<endl; continue; } int a=vec[0]; int sum=0; for(int i=1;i<n;i++){ if(a!=vec[i]){ sum++; } } cout<<sum<<endl; vec.clear(); } }
2031A
wrong_submission
297,162,637
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define int long long using namespace std; #define pb push_back #define vc vector #define pii pair <int, int> #define pn cout<<"NO"<<endl #define py cout<<"YES"<<endl void solve(){ int n;cin>>n; vector<int> v(n),fq(n+1,0); for(int i=0;i<n;i++){ cin>>v[i]; fq[v[i]]++; } int ans = n-1; for(int i=0;i<n;i++){ ans = min(ans,(n-fq[i])); } cout<<ans<<endl; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--){ solve(); } }
2031A
wrong_submission
291,595,624
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int t,n; vector<int> h; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>t; while(t--){ cin>>n; h.resize(n); for(int i=0;i<n;i++){ cin>>h[i]; } int ans=0,ans2=0; for(int i=1;i<n;i++){ if(h[i]>=h[i-1]){ continue; } else{ ans++; h[i]=h[i-1]; } } for(int i=0;i<n;i++){ if(h[i]>=h[i+1]){ ans2++; h[i]=h[i+1]; } } cout<<min(ans,ans2)<<endl; } return 0; }
2031A
wrong_submission
292,786,252
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
/*************** Author : Lakshay Dhiman ********************/ #include<bits/stdc++.h> using namespace std; void dbg_out() { cerr << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); } #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define ordered_set_pi tree<pair<int, int>, null_type,less<pair<int, int>>, rb_tree_tag,tree_order_statistics_node_update> #define char unsigned char #define sz(a) ((int)(a.size())) #define input(arr) for(auto &x: arr) cin >> x; #define output(arr, ...) for(auto &x: arr) cout << x << __VA_ARGS__; #define all(x) (x).begin(), (x).end() #define int long long typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<string> vs; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; typedef vector<vector<int>> vvi; typedef vector<vector<bool>> vvb; typedef vector<vector<ll>> vvll; typedef vector<vector<pii>> vvpi; typedef vector<vector<pll>> vvpl; const int MOD = 1e9 + 7; const int eps = 1e-9; void Lakshay(){ int n; cin>>n; vi v(n); input(v); int ans = 1; int cnt = 1; for(int i = 1; i < n; i++){ if(v[i] == v[i - 1]){ cnt++; continue; } else{ ans = max(ans, cnt); cnt = 1; } } cout<<n - ans<<endl; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; // int c = 1; cin >> t; while(t--){ // cout << "Case #" << c++ << ": "; Lakshay(); // cout << '\n'; } return 0; }
2031A
wrong_submission
291,579,269
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; #define F first #define S second #define PB push_back #define MP make_pair #define REP(i,a,b) for (int i = a; i <= b; i++) typedef long long ll; typedef long long int lli; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; const int INF = 1e9; // 10^9 = 1B is < 2^31-1 const double EPS = 1e-9; void solve() { int n; cin >> n; vi h(n); REP(i,0,n-1) { cin >> h[i]; } int cnt = 0; REP(i,1,n-1) { if(h[i] < h[i-1]) cnt++; } cout << cnt << endl; } int main() { int t; cin >> t; while (t--) { solve(); } }
2031A
wrong_submission
291,587,774
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define in(a, b) for (ll i = (a); i <= (b); i++) // in using i #define inj(a, b) for (ll j = (a); j <= (b); j++) // in using j #define ink(a, b) for (ll k = (a); k <= (b); k++) // in using k #define inl(a, b) for (ll l = (a); l <= (b); l++) // in using l #define inr(a, b) for (ll i = (a); i >= (b); i--) // in reverse #define inrj(a, b) for(ll j = (a); j >= (b); j--) // in reverse #define inrk(a, b) for(ll k = (a); k >= (b); k--) // in reverse #define inrl(a, b) for(ll l = (a); l >= (b); l--) // in reverse #define tt ll tcs; cin>>tcs; while(tcs--) // include test cases #define ina(arr,n) ll arr[(n+1)]={0}; in(1,n) cin>>arr[i] // input arr of n elements #define inv(vec,n) vector<ll> vec(n+1); vec[0]=0; in(1,n) cin>>vec[i]; // input vector of n elements #define pb push_back #define lb lower_bound #define ub upper_bound #define pll pair <ll,ll> #define vpll vector <pll> #define sll set <ll> #define spll set<pll> #define qll queue<ll> #define qpll queue<pll> #define vll vector<ll> #define mll map <ll,ll> #define fi first #define se second #define vvll vector<vll> #define vvpll vector<vpll> #define endl '\n' #define all(x) x.begin(), x.end() const ll mod=1e9+7; const ll INF=1e18; const ll N=1e6; // //pushes all primes till n in a vector // void PrimeSieve(ll n,vll &prime){ // ll CNT=0; // ll a[n+1]; // in(1,n) a[i]=i; // in(2,n){ // if(a[i]!=0){ // CNT++; // prime.pb(i); // //cout<<i<<' '; // // cout<<i<<endl; // for(ll j=i;j<=n;j+=i){ // a[j]=0; // } // } // } // // cout<<CNT; // } // // returns a to power b mod m in log b time // ll binexp(ll a, ll b,ll m) { // ll res = 1; // while (b > 0) { // if (b & 1) // res = (res * a)%m; // a = (a * a)%m; // b >>= 1; // } // return res; // } // // inserts lowest prime factor of i in a[i] till i=n in O(nlogn) // void insertlp(vll &v,ll n){ // v.assign(n+1,1); // in(2,n){ // if(v[i]==1){ // for(ll j=i;j<=n;j+=i){ // if(v[j]==1) v[j]=i; // } // } // } // } // // converts integer i to binary string of 'bits' bits // string toBinary(ll i, ll bits) // { // string s = ""; // while (i > 0) // { // if (i%2) // { // s += '1'; // } // else // s += '0'; // i/=2; // } // // cout<<s.length()<<' '<<bits<<endl; // while (s.length() < bits) // s += '0'; // reverse(s.begin(),s.end()); // return s; // } // // converts binary string to decimal number // ll toDecimal(string &n) // { // ll s=n.length(); // ll dec_value = 0; // // Initializing base value to 1, i.e 2^0 // ll base = 1; // inr(s-1,0) if(n[i]=='1') dec_value+=pow(2,s-1-i); // return dec_value; // } // ll gcd(ll a,ll b){ // int x = min({a,b}); int y = max({a,b}); // int modf = y%x; // if(modf==0) // { // return x; // } // else{ // while(modf>0){ // y=x; // x=modf; // modf = y%x; // } // return x; // } // } // ll lcm(ll a, ll b){ // return ((a/gcd(a,b))*b); // } // void swap(ll &x, ll &y){ // ll temp = x; // x = y; // y = temp; // } // =================================================== // || //------------\ || // || // \ || // || // O O \ || // || \ ! // || // || \ // || // || \ ---------- // || // || L___________J || // =================================================== // Jab bhi koi naya vector ya array banao toh uska size define karo. void solve() { int n; cin>>n; inv(vec, n); int q = ceil(double(n)/2); // cout<<q<<endl; int c = 0; in(1, n) if(vec[i]!=vec[q]) c++; cout<<c<<endl; } int main() { cin.tie(nullptr)->sync_with_stdio(false); tt{ solve(); } // solve(); }
2031A
wrong_submission
291,597,751
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #include <bits/stdc++.h> using namespace std; #define pi 3.141592653 #define rev reverse #define rep(i,n) for (long long i = 0; i < n; i++) #define rep_a(i,a,n) for (long long i = a; i < n; i++) #define drep(i,n) for (long long i = n-1; 0 < i+1; i--) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(), (a).rend() #define m_set multiset #define p_queue priority_queue //#define min_p_queue<(n)> priority_queue<(n),vector<(n)>,greater<(n)>> using ll = long long; using ull = unsigned long long; using ld = long double; string azl="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string azs="abcdefghijklmnopqrstuvwxyz"; int main(void){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n;cin>>n; for(;n--;){ ll m;cin>>m; vector<ll> a(m); rep(i,m)cin>>a[i]; if(m==1){ cout<<0<<endl; }else{ ll count=0; rep(i,m-1){ if(a[i]!=a[i+1])count++; } cout<<count<<endl; } } return 0; }
2031A
wrong_submission
291,623,142
Java 21
WRONG_ANSWER on test 2
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { int n = scanner.nextInt(); int[] heights = new int[n]; for (int j = 0; j < n; j++) { heights[j] = scanner.nextInt(); } int operations = 0; int lastHeight = 0; for (int j = 0; j < n; j++) { if (heights[j] < lastHeight) { operations++; } else { lastHeight = heights[j]; } } System.out.println(operations); } scanner.close(); } }
2031A
wrong_submission
300,344,789
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--) { vector<int> arr; int n; cin >> n; arr.clear(); arr.resize(n); for(auto &z : arr) cin >> z; int countOn = 0; for(int i = 0; i < n; i++) { if(arr[0] > arr[i]) { countOn++; } } cout << countOn << endl; } return 0; }
2031A
wrong_submission
291,578,393
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long #define endl '\n' const ll N = 2e5 + 5, MOD = 998244353; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("C:\\Users\\zisak\\CLionProjects\\problemsolving\\input.txt", "r", stdin); freopen("C:\\Users\\zisak\\CLionProjects\\problemsolving\\output.txt", "w", stdout); #endif int t, n; cin >> t; while (t--) { cin >> n ; set<ll> ms; for (int i = 0; i < n; ++i) { ll x; cin >> x; ms.insert(x); } cout << ms.size() - 1 << endl; } return 0; }
2031A
wrong_submission
291,588,809
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int main(){ int T; cin>>T; while(T--){ int n; cin>>n; vector<int> v(n); for(int i=0; i<n; i++) cin>>v[i]; int i = 0; int s = 1; while(i < n){ int prev = i; if(i + 1 < n && v[i] == v[i + 1]){ i++; } if(i != prev) s = max(s, i - prev + 1); else i++; } cout<<n - s<<endl; } return 0; }
2031A
wrong_submission
293,078,205
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class PMMonument { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] h= new int[n]; for(int i = 0; i < n; i++ ){ h[i] = sc.nextInt(); } int operations = 0; for (int i = n - 2; i >= 0; i--) { if (h[i] > h[i + 1]) { operations = h[i] - h[i + 1]; h[i] = h[i + 1]; } } System.out.println(operations); } sc.close(); } }
2031A
wrong_submission
292,960,108
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <algorithm> #include <iostream> #include <cmath> #include <bits/stdc++.h> #include <fstream> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define Ahmed cin.tie(0), cout.tie(0), cin.sync_with_stdio(0), cout.sync_with_stdio(0); #define all(v) v.begin(), v.end() #define allRev(v) v.rbegin(), v.rend() #define clr(arr, val) memset(arr, val, sizeof(arr)) #define ll long long #define F first #define S second #define GCD __gcd #define el '\n' #define pii pair<int, int> #define pll pair<ll, ll> #define popcnt(n) __builtin_popcount(n) #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, \ tree_order_statistics_node_update> using namespace std; using namespace __gnu_pbds; const ll mod = 1e9 + 7; const int N = 2e5 + 5, Log = 22; const double pi = 3.14159265358979323846; int dirX[4] = {0, +0, 1, -1}; int dirY[4] = {1, -1, 0, +0}; void start() { Ahmed // cout << fixed << setprecision(12); // cin.ignore(); // getline(cin, variable); // #ifndef ONLINE_JUDGE // freopen("fence.in", "r", stdin); // freopen("output.txt", "w", stdout); // #endif } void solve() { int n;cin >> n; int ans = 0, last; for (int i = 0; i < n; ++i) { if (!i) { cin >> last; continue; } int x;cin >> x; if (x < last) ans++; } cout << ans << el; } int main() { start(); int t = 1; cin >> t; while (t--) solve(); }
2031A
wrong_submission
301,672,517
Java 21
WRONG_ANSWER on test 2
//package codeforces; import java.util.*; import java.lang.*; import java.math.*; import java.io.*; public class submission { public static void main(String[] args) { int cases = sc.nextInt(); while (cases-- > 0) { int n = sc.nextInt(); int[] h = new int[n]; int s = 0; int t = 0; for (int i = 0; i < n; i++) { h[i] = sc.nextInt(); } for (int i = 0; i < n; i++) { if (h[i] == h[0]) { s++; } if (h[i] == h[n-1]) { t++; } } out.println(Math.min(n - t, n - s)); } out.close(); } static long pow(long a, long b, long mod) { if (b == 0) { return 1L; } long val = pow(a, b / 2, mod); if (b % 2 == 0) { return val * val % mod; } return val * val % mod * a % mod; } static int gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } static int lcm(int a, int b) { return a * b / gcd(a, b); } static Kattio sc = new Kattio(); static PrintWriter out = new PrintWriter(System.out); static class Kattio { static BufferedReader r; static StringTokenizer st; public Kattio() { r = new BufferedReader(new InputStreamReader(System.in)); } public String next() { try { while (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(r.readLine()); } return st.nextToken(); } catch (Exception e) { return null; } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } } }
2031A
wrong_submission
291,599,044
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class A_Penchick_and_Modern_Monument { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while (T-- > 0) { int N = sc.nextInt(); int arr[] = new int[N]; for (int i = 0; i < N; i++) { arr[i] = sc.nextInt(); } System.out.println(solve(arr)); } sc.close(); } static int solve(int arr[]) { int ans = 0; for (int i = 0; i < arr.length - 1; i++) { if (arr[i] > arr[i + 1]) { ans++; } } return ans; } }
2031A
wrong_submission
298,958,024
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define ll long long #define lli long long int #define lld long long double #define ull unsigned long long #define mxt(a) *max_element(a.begin(),a.end()) #define mnt(a) *min_element(a.begin(),a.end()) #define mxti(a,i,j) *max_element(a.begin()+i+1,a.begin()+j+1) #define mnti(a,i,j) *min_element(a.begin()+i+1,a.begin()+j+1) #define acm(v,i,j) accumulate(v.begin()+i+1,v.begin()+j+1,0ll) //extract sub vector from main vector //vector<int> sub_vector(main_vector.begin()+start_index,main_vector.begin()+end_index) #define srt(a) sort(a.begin(),a.end()) #define rev(a) reverse(a.begin(),a.end()) #define all(a) a.begin(),a.end() #define sp " " #define nl '\n' #define op(a) for(int i=0;i<a.size();i++)cout<<a[i]<<" " #define in(a) for(int i=0;i<a.size();i++) cin>>a[i] #define mii map<int,int> #define mis map<int,string> #define msi map<string,int> #define mci map<char,int> #define mic map<int,char> // pairs #define pii pair<int, int> #define pll pair<ll, ll> #define pdd pair<db, db> #define mkp make_pair #define f first #define s second #define vi vector<int> #define vll vector<ll> #define vpi vector<pi> #define vs vector<string> #define vc vector<char> #define vvi vector<vector<int>> #define vvll vector<vector<ll>> #define vvs vector<vector<string>> #define vvc vector<vector<char>> #define pb push_back #define fre(x, a) for (auto &x : a) #define fr(a,c,b) for(ll a=c;a<b;a++) #define MOD 1000000007 const int MX = (int)2e5 + 5; const ll BIG = 1e18; // not too close to LLONG_MAX const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1}; // for every grid problem!! #define PYES cout<<"YES\n" #define PNO cout<<"NO\n" #define PYes cout<<"Yes\n" #define PNo cout<<"No\n" #define fastIO() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using namespace std; //--------------------------------------------DEBUG-------------------------------------------------// #ifndef ONLINE_JUDGE #define dg(x) cerr << #x <<" --> "; _print(x); cerr << endl; #else #define dg(x) #endif void _print(ll t) { cerr << t; } void _print(int t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(double t) { cerr << t; } void _print(ull t) { cerr << t; } // Forward declarations for templates template <class T, class V> void _print(pair <T, V> p); template <class T> void _print(vector <T> v); template <class T> void _print(set <T> v); template <class T, class V> void _print(map <T, V> v); template <class T, class V> void _print(multimap <T, V> v); template <class T> void _print(multiset <T> v); // Definitions for templates template <class T, class V> void _print(pair <T, V> p) { cerr << "{"; _print(p.first); cerr << ", "; _print(p.second); cerr << "}"; } template <class T> void _print(vector <T> v) { cerr << "[ "; for (T i : v) { _print(i); cerr << " "; } cerr << "]"; } template <class T> void _print(set <T> v) { cerr << "{ "; for (T i : v) { _print(i); cerr << " "; } cerr << "}"; } template <class T> void _print(multiset <T> v) { cerr << "{ "; for (T i : v) { _print(i); cerr << " "; } cerr << "}"; } template <class T, class V> void _print(map <T, V> v) { cerr << "{ "; for (auto i : v) { _print(i); cerr << ", "; } cerr << "}"; } template <class T, class V> void _print(multimap <T, V> v) { cerr << "{ "; for (auto i : v) { _print(i); cerr << ", "; } cerr << "}"; } //--------------------------------------------functions-------------------------------------------------// vector<int> Prefn(const string &s) { int n = s.size(); vector<int> pi(n, 0); for (int i = 1; i < n; i++) { int j = pi[i - 1]; while (j > 0 && s[i] != s[j]) { j = pi[j - 1]; // Fall back to the next best prefix } if (s[i] == s[j]) { j++; } pi[i] = j; } return pi; } vector<int> KMP(const string &text, const string &pattern) { string combined = pattern + "#" + text; vector<int> pi = Prefn(combined); vector<int> result; int patternLength = pattern.length(); for (int i = patternLength + 1; i < pi.size(); i++) { if (pi[i] == patternLength) { result.push_back(i - 2 * patternLength); } } return result; } ll power(ll a,ll b){ ll result=1; while(b>0){ if(b%2 == 1){ result *= a; } a *= a; b /= 2; } return result; } ll gcd(ll x,ll y){ ll r; while(y!=0&&(r=x%y)!=0){ x=y;y=r; } return y==0?x:y; } ll countSetBits(ll x){ll Count=0;while(x>0){if(x&1) Count++;x=x>>1;}return Count;} ll mod(ll x,ll M){return ((x%M + M)%M);} ll add(ll a, ll b,ll M){return mod(mod(a,M)+mod(b,M),M);} ll mul(ll a, ll b,ll M){return mod(mod(a,M)*mod(b,M),M);} ll powerM(ll a,ll b,ll M){ ll res=1ll; while(b){ if(b%2ll==1ll){ res=(a*res)%M; } a=(a*a)%M;b/=2ll; } return res; } ll mod_inv(ll a, ll m) { ll g = m, r = a, x = 0, y = 1; while (r != 0) { ll q = g / r; g %= r; swap(g, r); x -= q * y; swap(x, y); } return (x%m + m)%m; } ll fact(ll n) { if (n == 0 || n == 1) return 1; return n * fact(n - 1); } ////------------------------------------sieve of Eratosthenes-----------------------------------------------// //----------------------------------------nCr mod------------------------------------------------------// ll nCr(ll n, ll k){ if(n<k) return 0; if(k==0) return 1; ll res = 1; if (k > n - k) k = n - k; for(ll i = 0; i < k; ++i){ res *= (n - i); res /= (i + 1); } return res; } vector<ll> FA,INV; void fcalc(ll n,ll M){ FA.resize(n+1); FA[0]=1; for(ll i=1;i<=n;i++){ FA[i]=(FA[i-1]*i)%M; } } void icalc(ll n,ll M){ INV.resize(n+1); INV[n]=mod_inv(FA[n],M); for(ll i=n-1;i>=0;i--){ INV[i]=(INV[i+1]*(i+1))%M; } } ll nCrM(ll n,ll r,ll M){ if(r<0) return 0; if(n<r) return 0; if(r==0) return 1; ll a=FA[n]; a*=INV[r]; a%=M; a*=INV[n-r]; a%=M; return a; } ll mod_exp(ll base, ll exp, ll mod) { ll result = 1; while (exp > 0) { if (exp % 2 == 1) { result = (result * base) % mod; } base = (base * base) % mod; exp = exp / 2; } return result; } // ll rand_int(ll l, ll r){ // return uniform_int_distribution<ll>(l, r)(rng); // } ifstream fin; ofstream fout; template <typename T> ostream& operator <<(ostream& output, const vector<T>& data) { for (const T& x : data) output << x <<" "; return output; } template<typename T> istream& operator>>(istream& input,vector<T>& data){ for (auto& item : data) { input >> item; } return input; } int LCM(int a, int b){ return ((a * b) / gcd(a, b)); } ll ceil(ll a, ll b){// a / b return a / b + ((a ^ b) > 0 && a % b); } // bool inl(int i,int j,int m,int n){ // return (i>=0 && j>=0 && i<m && j<n); // } //--------------------------------------------solve----------------------------------------------// bool isPerfectSquare(ll num) { if (num < 0) { return false; } int sqrtValue = static_cast<int>(sqrt(num)); return (sqrtValue * sqrtValue == num); } vvll divi(2e5 + 1); void divisors() { fr(i, 1, 2e5 + 1) { for (ll j = i; j <= 2e5; j += i) divi[j].pb(i); } } vector<bool> isPrime(1e6+50,true); void seive(){ isPrime[0] = isPrime[1] = false; fr(i,2,1e3+1){ if(isPrime[i]){ for(ll j=i*i;j<=1e6;j+=i){ isPrime[j]=false; } } } } void solve() { ll t;cin>>t; while(t--){ ll n;cin>>n; vll a(n);in(a); vll b=a; ll ct1=0; fr(i,1,n){ if(a[i]<a[i-1]){ ct1++; a[i]=a[i-1]; } } ll ct2=0; for(ll i=n-1;i>0;i--){ if(b[i]<b[i-1]){ ct2++; b[i-1]=b[i]; } } dg(a); cout<<min(ct1,ct2)<<nl; } } int main() { ios::sync_with_stdio(false); cin.tie(0); solve(); return 0; }
2031A
wrong_submission
300,466,726
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; #define ll long long void solve() { ll n; cin >> n; vector<ll> vc(n); for (ll i = 0; i < n; i++) cin >> vc[i]; vector<ll> prev = vc ; ll cnt = 0 ; for(ll i = 1 ; i<n ; i++){ if(vc[i]<vc[i-1]){ vc[i] = vc[i-1]; cnt++; } } ll a = 0 ; vc = prev ; for(ll i = n-2 ; i>=0 ; i--){ if(vc[i+1]<vc[i]){ a++; vc[i] = vc[i+1]; } } cout<<min(a,cnt)<<endl; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t; cin >> t; for (ll i = 0; i < t; i++) { solve(); } return 0; }
2031A
wrong_submission
291,585,040
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int x = 0; x < t; x++) { int n = sc.nextInt() ; int count = 0 ; int pre = 0 ; for(int i = 0 ; i < n ; i++){ int num = sc.nextInt() ; if(i == 0) pre = num ; else{ if(pre > num) { count++ ; pre = num ; } } } System.out.println(count); } sc.close(); } }
2031A
wrong_submission
302,773,038
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); int[] h = new int[n]; for (int i = 0; i < n; i++) { h[i] = scanner.nextInt(); } int operations = 0; for (int i = 0; i < n - 1; i++) { if (h[i] > h[i + 1]) { operations += h[i] - h[i + 1]; h[i] = h[i + 1]; } } System.out.println(operations); } scanner.close(); } } // d1uik5z0RXWh27sUEPn
2031A
wrong_submission
291,677,272
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { ll t; cin>>t; while(t--) { ll n; cin>>n; vector<ll>v; for(ll i=0; i<n; i++) { ll x; cin>>x; v.push_back(x); } set<int> uniqueElements(v.begin(), v.end()); cout<<uniqueElements.size()-1<<endl; } }
2031A
wrong_submission
292,793,573
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define int long long #define pb push_back #define f(i, s, n) for (int i = s; i < n; i++) #define fr(i, n, s) for (int i = n; i >= s; i--) #define fa(ele, vec) for (auto ele : vec) #define pii pair<int, int> #define pyes cout << "YES" #define pno cout << "NO" #define all(arr) arr.begin(), arr.end() #define vi vector<int> #define vvi vector<vector<int>> #define vs vector<string> #define vvs vector<vector<string>> #define vc vector<char> class Trie { vector<vector<int>> trie_node; vector<int> end_node; int counter; public: Trie(int total_node) { counter = 0; for(int i=0; i<total_node; i++) { vector<int> char_node((int)26, 0); trie_node.push_back(char_node); end_node.push_back(0); } } void insert(string word) { int curr = 0; for(char character: word) { if(trie_node[curr][character-'a'] == 0) { trie_node[curr][character-'a'] = ++counter; } curr = trie_node[curr][character-'a']; } end_node[curr] = 1; } }; void sort_two_array(vi &arr1, vi &arr2, bool descending = 0) { int n = arr1.size(); vi indices(n); for (int i = 0; i < n; ++i) { indices[i] = i; } if (descending == 0) { sort(indices.begin(), indices.end(), [&](int a, int b) { return arr1[a] < arr1[b]; }); } else { sort(indices.begin(), indices.end(), [&](int a, int b) { return arr1[a] > arr1[b]; }); } if (descending == 0) { sort(arr1.begin(), arr1.end()); } else { sort(arr1.begin(), arr1.end()); reverse(arr1.begin(), arr1.end()); } vi temp(n); f(i, 0, n) { temp[i] = arr2[indices[i]]; } f(i, 0, n) { arr2[i] = temp[i]; } } int sumofdigits(int x) { int temp = x; int sum = 0; while (temp != 0) { sum += temp % 10; temp = temp / 10; } return sum; } int custompow(int m, int n) { int ans = 1; f(i, 1, n + 1) { ans = ans * m; } return ans; } int powerof2(int n) { f(i, 1, n + 1) { if (pow(2, i) > n) { return i - 1; } } return 0; } int gcd(int a, int b) { while (b != 0) { int temp = b; b = a % b; a = temp; } return a; } // Function to calculate the HCF of an array of numbers int findHCF(vi arr, int n) { int hcf = arr[0]; for (int i = 1; i < n; ++i) { hcf = gcd(hcf, arr[i]); } return hcf; } int binarysearch(vi arr, int num) { int n = arr.size(); int s = 0, e = n - 1; while (s <= e) { int mid = (s + e) / 2; if (mid == s) { break; } if (arr[mid] == num) { return mid; } else if (arr[mid] > num) { e = mid; } else s = mid; } if (num >= arr[e]) { return e; } else if (num <= arr[s]) { return s; } else { if ((num - arr[s]) <= (arr[e] - num)) { return s; } else return e; } return -1; } string intToBinary(int number, int numBits) { return std::bitset<sizeof(int) * 8>(number).to_string().substr(sizeof(int) * 8 - numBits); } int binaryToInt(string binaryString) { int ans = 0; int n = binaryString.size(); f(i, 0, n) { if (binaryString[i] == '1') { ans = ans + custompow(2, n - i - 1); } } return ans; } vector<string> all_binary_subseq(int n) { vector<string> ans; f(i, 0, custompow(2, n)) { ans.push_back(intToBinary(i, n)); } return ans; } vi findDivisors(int num) { vi divisors; for (int i = 1; i * i <= num; ++i) { if (num % i == 0) { divisors.push_back(i); // If the divisor is not equal to the square root, add the corresponding divisor if (i != num / i) { divisors.push_back(num / i); } } } return divisors; } string XOR(string a, string b) { string ans = ""; f(i, 0, a.size()) { if (a[i] == b[i]) ans.push_back('0'); else ans.push_back('1'); } return ans; } int sum_of_vector(vi &arr) { int sum = 0; for (auto a : arr) { sum += a; } return sum; } void take_vec_input(vi &arr) { int n = arr.size(); f(i, 0, n) cin >> arr[i]; } void give_vec_output(vi arr) { int n = arr.size(); f(i, 0, n) cout << arr[i] << " "; } int find_max(vi &a) { int ans = a[0]; f(i, 1, a.size()) { ans = max(ans, a[i]); } return ans; } int KMP(string a, string b) { if(a == "" || b == "")return 0; vi lsp(b.size(), 0); int k = 1; f(i, 0, b.size()) { if(k-1 != i && b[k-1] == b[i]) { lsp[i] = k; k++; } else k = 1; } k = -1; int i; bool flag = 0; for(i=0; i < a.size(); i++) { if(a[i] == b[k+1] || a[i] == '?') { k++; if(k+1 == b.size()) { flag = 1; break; } } else { if(k != -1) { k--; k = lsp[k]-1; i--; } } } if(flag == 1) { return i-k; } return -1; } int ncr(int n, int r) { if(n < r)return 0; int ans = 1; for(int i=1; i<=r; i++) { ans *= ((n-r+i)/i); ans = ans%mod; } return ans; } int ask(int u, int v) { cout << "? " << u << " " << v << endl; int ans; cin >> ans; return ans; } /* lower_bound(A.begin(), A.end(), num) - A.begin() will return first index in A where num should be kept so that no change in order upper_bound(A.begin(), A.end(), num) - A.begin() will return index such that num will be kept there and all the number right of num must be strictly greater than num 3 << 4 --> left shift of all (important) the bits of 3 by 4 position 3 >> 4 --> right shift of all (important) the bits of 3 by 4 position (eg 10 >> 4 == 0) binary search on the answer */ //---------------------------------------------------------------------------- void solve(int curr) { int n; cin>>n; vi h(n); take_vec_input(h); int max_conti = 0; int prev = -1; int tempcount = 1; f(i, 0, n) { if(prev == h[i])tempcount++; else { prev = h[i]; max_conti = max(max_conti, tempcount); tempcount = 1; } } cout<<n - max_conti; } //--------------------------------------------------------------------------------- signed main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t = 1; cin >> t; int start = 0; while (start != t) { start++; solve(start); cout << endl; } return 0; }
2031A
wrong_submission
292,351,163
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; #define ll long long int void solve() { ll op=0; ll n; cin>>n; vector<ll>v(n+1); for(ll i=1;i<=n;i++) { cin>>v[i]; if(i!=1&&v[i]<v[i-1]) { op+=1; v[i]=v[i-1]; } } cout<<op<<endl; } int main() { ll t; cin >> t; while (t--) { solve(); } return 0; }
2031A
wrong_submission
300,824,342
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class main{ public static void main(String[] args){ Scanner in= new Scanner(System.in); int t=in.nextInt(); while(t-->0){ int n = in.nextInt(); in.nextLine(); // Consume the leftover newline // Read a string String s = in.nextLine(); // Split the string by whitespace String[] h = s.split("\\s+"); int [] a= new int[h.length]; for(int i=0;i<h.length;i++){ a[i]=Integer.parseInt(h[i]); } int max=1; int curr=1; for(int i=0;i<a.length-1;i++){ if(max<curr){ max=curr; } if(a[i]==a[i+1]){ curr++; } else{ curr=0; } } // Print the array System.out.println(h.length-max); } in.close(); } }
2031A
wrong_submission
292,679,263
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAX = 200'007; //int res[MAX]; #define all(x) (x).begin(), (x).end() #define revall(x) (x).rbegin(), (x).rend()// reverse vector. put vector name instead of x void X() { long long n, m, k, a = 0, b = 0, c, sum = 0, cnt1 = 0, cnt2 = 0, ans = 0, cnt3 = 1; string s; char ch; cin>>n; vector<ll> v(n); for(int i=0;i<n;i++){ cin>>v[i]; } for(int i=0;i<n;i++){ if(v[i]>v[i+1]) { cnt1++; } } cout<<cnt1<<endl; } //function END int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; cin >> t; while (t--) { X(); } return 0; }
2031A
wrong_submission
292,483,801
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; int t,n,dp[100],h[100]; int main(){ scanf("%d",&t); while(t--){ scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&h[i]); dp[1]=1; for(int i=2;i<=n;i++){ for(int j=i-1;j>=1;j--){ if(h[i]>=h[j])dp[i]=max(dp[i],dp[j]+1); } } int ans=1; for(int i=1;i<=n;i++)ans=max(ans,dp[i]); printf("%d\n",n-ans); } return 0; }
2031A
wrong_submission
293,301,546
Java 8
WRONG_ANSWER on test 2
import java.util.*; public class Main { public static void main(String[] args){ Scanner fs=new Scanner(System.in); int t=fs.nextInt(); for(int k=0;k<t;k++){ int n=fs.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++){ arr[i]=fs.nextInt(); } long ans=0; for(int i=0;i<n-1;i++){ if(arr[i]!=arr[i+1]){ arr[i]=arr[i+1]; ans++; } } System.out.println(ans); } } }
2031A
wrong_submission
291,893,422
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class A_Penchick_and_Modern_Monument { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); int[] h = new int[n]; int count = 0; for (int i = 0; i < n; i++) { h[i] = scanner.nextInt(); } int max = 0; for(int i = 0;i<n;i++){ if(h[i] > max ){ max = h[i]; } } for(int i = 0;i<n;i++){ if(max !=h[i]){ count++; } } System.out.println(count); } } }
2031A
wrong_submission
294,374,483
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; int a[200001]; int main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); int t; cin>>t; while(t--){ int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; int f=1; for(int i=1;i<=n&&f;i++){ if(a[i]<a[i-1]){ cout<<n-i+1<<"\n"; f=0; } } if(f==1) cout<<"0\n"; } }
2031A
wrong_submission
291,587,672
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class A{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); int arr[] = new int[n]; int max = 0; for(int i=0; i<n; i++){ arr[i] = sc.nextInt(); max = Math.max(max, arr[i]); } if(n == 1) System.out.println(0); else{ int actualLength = 0; int count[] = new int[max+1]; for(int i : arr){ count[i]++; } for(int i : count){ if(i != 0){ actualLength++; } } System.out.println(actualLength - 1); } } } }
2031A
wrong_submission
293,223,334
Java 21
WRONG_ANSWER on test 2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A_Penchick_and_Modern_Monument { public static void main(String[] args) { FastScanner fs = new FastScanner(); int T = fs.nextInt(); for (int tt = 0; tt < T; tt++) { int n = fs.nextInt(); int arr[] = fs.readArray(n); int count = 0; for (int i = 0; i < n - 1; i++) { if (arr[i] == arr[i + 1]) { count++; } } System.out.println(n - count - 1); } } static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next() { while (!st.hasMoreTokens()) try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } int[] readArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); return a; } long nextLong() { return Long.parseLong(next()); } } }
2031A
wrong_submission
293,980,037
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; #define M__K ios::sync_with_stdio(false); cin.tie(0); #define lcm(a, b) ((a) * (b) / (__gcd((a), (b)))) #define ll long long int #define vi vector<int> #define vll vector<long long> #define vch vector<char> #define vstr vector<string> #define pii pair<int, int> #define pll pair<long long, long long> #define all(x) (x).begin(), (x).end() #define srt(x) sort(all(x)) #define rev(x) reverse(all(x)) #define ff first #define ss second #define pb push_back #define vpii vector<pii> #define vpll vector<pll> #define endl "\n" #define println(x) cout << (x) << "\n"; #define print(x) cout << (x); #define prints(x) cout << (x) << " "; #define in(x) cin >> (x); #define forn(i,n) for(int i = 0; i < (n); ++i) #define forab(i,a,b) for(int i = (a); i <= (b); ++i) #define forabrev(i,a,b) for(int i = (b); i >=(a); --i) #define forall(it, v) for(auto &it : v) #define yes cout<<"YES\n"; #define no cout<<"NO\n"; const int M=1e9+7; void solve(){ int n; cin>>n; vi v(n); forn(i,n) cin>>v[i]; int cnt=0; for(int i=n-2;i>=0;--i){ if(v[i+1]<v[i]){ cnt++; } } println(cnt); } int main(){ M__K; int t=1; in(t); while(t--){ solve(); } return 0; }
2031A
wrong_submission
291,594,831
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testcases = scanner.nextInt(); int count =0; int first =0; for(int j=0;j<testcases;j++) { int bilnumber = scanner.nextInt(); int[] h = new int[bilnumber]; // the heights of the monuments pilliars for(int i=0;i<h.length;i++) { h[i] = scanner.nextInt(); if(h[i] < first) { count++; } first = h[i]; } System.out.println(count); count =0; } } }
2031A
wrong_submission
291,620,354
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Penchickandmonument { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++){ arr[i]=sc.nextInt(); } if(n==1){ System.out.println(0); continue; } int count=0; if(arr[0]>arr[1]){ count++; } if(arr[n-2]>arr[n-1]){ count++; } for(int i=1;i<n-2;i++){ if(arr[i]>arr[i+1]){ count++; } } System.out.println(count); } sc.close(); } }
2031A
wrong_submission
291,597,151
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; // void testcase (void) { int n, h[55], f[55]; // cin >> n; for (int i = 1; i <= n; ++i) cin >> h[i]; memset(f, 0, sizeof f); f[1] = 1; for (int i = 2; i <= n; ++i) for (int j = 1; j < i; ++j) if (h[j] <= h[i]) f[i] = max(f[i], f[j] + 1); cout << n - *max_element(f + 1, f + n + 1); } void process (void) { int t; // for (cin >> t; t--; cout << '\n') testcase(); } // signed main (void) { ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); process(); }
2031A
wrong_submission
291,605,366
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int j = 0; j < t; j++) { int n = scanner.nextInt(); int[] h = new int[n]; for (int i = 0; i < n; i++) { h[i] = scanner.nextInt(); } int operations = 0; for (int i = 1; i < n; i++) { if (h[i] < h[i - 1]) { operations++; } } System.out.println(operations); } } }
2031A
wrong_submission
291,583,410
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class A_Penchick_and_Modern_Monument { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); int a[] = new int[n]; for(int i = 0; i < n; i++){ a[i] = sc.nextInt(); } if(n == 1){ System.out.println(0); } else if (a[0] == n){ System.out.println(n - 1); } else { System.out.println(n-a[0]); } } } }
2031A
wrong_submission
291,592,455
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #define FAST_IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define dbg(x) cout<<#x<<" = "<<x<<'\n'; #define yes cout<<"YES"<<'\n'; #define no cout<<"NO"<<'\n'; #define ll long long #define MOD 1e9 + 7 #define nl '\n' using namespace std; void solve(){ int n; cin >> n; vector<int> a(n); for(auto &it : a){ cin >> it; } int mid = a[n / 2]; // dbg(mid) int cnt = 0; for (int i = 0; i < n / 2; ++i){ if (mid != a[i]){ ++cnt; } } for (int i = n / 2 + 1; i < n; ++i){ if (mid != a[i]){ ++cnt; } } cout << cnt << nl; } int main(){ FAST_IO; //Start Here int t=1; cin >> t; while (t--){ solve(); } return 0; }
2031A
wrong_submission
291,620,970
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Q_19 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int count = 0; for (int i = 1; i < n; i++) { if (a[i] < a[i - 1]) { count++; a[i] = a[i - 1]; } } System.out.println(count); } sc.close(); } }
2031A
wrong_submission
291,610,297
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class penchickAndModernMonument { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tests = sc.nextInt(); for(int i=0; i<tests; i++){ int n = sc.nextInt(); int[] h = new int[n]; for(int j=0; j<n; j++){ h[j] = sc.nextInt(); } if(n == 1){ System.out.println(0); continue; } int count = 1; for(int k=0; k<h.length-1; k++){ if(h[k] == h[k+1]){ count++; } } if(count == 1){ System.out.println(h.length-1); } else{ System.out.println(h.length - count); } } } }
2031A
wrong_submission
291,777,240
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class _2031A_Penchick { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); int arr[] = new int[n]; for(int i = 0; i<n; i++){ arr[i] = sc.nextInt(); } int count =0; for(int i = 0; i<n; i++){ if(n==1){ count =0; } else if(arr[i]>arr[n/2]){ arr[i] = arr[(n/2)]; count++; }else if(arr[i]<arr[n/2]){ arr[i] = arr[(n/2)]; count++; }else continue; }System.out.println(count); } } }
2031A
wrong_submission
291,598,489
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using u32 = unsigned; using i64 = long long; using u64 = unsigned long long; void solve() { int n; std::cin >> n; std::vector<int> h(n); for (int &i: h) { std::cin >> i; } bool ok = false; int ans = 0; for (int i = 0; i < n - 1; i++) { if (h[i] == h[i + 1]) { ans += ok; } if (h[i] > h[i + 1]) { ok = true; ans++; } } std::cout << ans << "\n"; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr), std::cout.tie(nullptr); int T = 1; std::cin >> T; while (T--) { solve(); } return 0; }
2031A
wrong_submission
291,644,353
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class practice{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); for(int i=0;i<a;i++){ int b = sc.nextInt(); int [] arr = new int[b]; for(int k=0;k<b;k++){ arr[k] = sc.nextInt(); } int count =0; for(int j=0;j<b-1;j++){ if(arr[j]<=arr[j+1]){ count=count+1; } else if(count !=0){ break; } } if(count==0){ System.out.println(b-1); } else if(b==1){ System.out.println(0); } else{ System.out.println(b-(count+1)); } } } }
2031A
wrong_submission
291,604,556
Java 8
WRONG_ANSWER on test 2
import java.util.*; public class Main{ public static void main(String arr []){ Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0){ int n=s.nextInt(); int a[]=new int[n]; for(int i=0;i<n;i++){ a[i]=s.nextInt(); } int c=0; for(int i=n/2;i>0;i--){ if(a[i]<a[i-1]){ c=c+1; } } for(int i=n/2;i<n-1;i++){ if(a[i]>a[i+1]){ c=c+1; } } System.out.println(c); } } }
2031A
wrong_submission
291,582,729
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
//#include <bro is motivated>; #include <bits/stdc++.h> using namespace std; int n, t, a[60]; int main(){ cin >> t; while(t--) { cin >> n; int count = 0; for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 1; i < n; i++) if(a[i] < a[i - 1]) count++; cout << count << endl; } }
2031A
wrong_submission
291,622,731
Java 21
WRONG_ANSWER on test 2
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class round987 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while (t -- > 0){ int n = input.nextInt(); int[] arr = new int[n]; //Set<Integer> set = new HashSet<>(); for (int i = 0; i < n; i++) { arr[i] = input.nextInt(); } int count = 0; for (int i = 1; i < n; i++) { if (arr[i - 1] > arr[i ]){ count = count + (arr[i - 1] - arr[i ]); arr[i - 1] = arr[i ]; } } System.out.println(count); // 10 9 9 8 } } static void printArray(int[] arr){ int n = arr.length; for (int j : arr) { System.out.print(j + " "); } System.out.println(); } }
2031A
wrong_submission
291,681,503
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> typedef long long ll; #define pb push_back #define ff first #define ss second #define pii pair<int, int> #define vi vector<int> #define vll vector<long long> #define vii vector<pair<int, int>> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { int n; cin >> n; vi h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } sort(h.begin(), h.end()); set<int> m; for(int i=0; i<n;i++){ m.insert(h[i]); } cout << m.size()-1<< endl; } return 0; }
2031A
wrong_submission
291,601,048
Java 8
WRONG_ANSWER on test 2
import java.util.*; public class assig { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); while(T-->0){ int N = in.nextInt(); int[] h = new int[N]; for (int i = 0; i < h.length; i++) { h[i] = in.nextInt(); } if(N==1){ System.out.println(0); } else { int count =0; for (int i = 0; i < h.length-1; i++) { if(h[i]>h[i+1]){ count++; } } System.out.println(count); } } } }
2031A
wrong_submission
295,739,075
Java 21
WRONG_ANSWER on test 2
/* वक्रतुण्ड महाकाय सूर्यकोटि समप्रभ। निर्विघ्नं कुरु मे देव सर्वकार्येषु सर्वदा। */ import java.io.BufferedReader; import java.time.Duration; import java.time.Instant; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class A_Penchick_and_Modern_Monument{ // Time complexity = O(sqrt(n)) public static boolean isPrime(int n) { if (n <= 1) { return false; } for (int i = 2; i <= Math.sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } //GCD OF TWO NUMBERS public static long gcd(long a, long b){ if(a == 0){ return b; } return gcd(b % a, a); } //LCM OF TWO NUMBERS public static long LCM(int a, int b){ return ((long) a * b) / gcd(a, b); } // FOR TAKING FASTER INPUTS static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { if(st.hasMoreTokens()){ str = st.nextToken("\n"); } else{ str = br.readLine(); } } catch (IOException e) { e.printStackTrace(); } return str; } } public static long decimalToBinary(long decimal) { if (decimal == 0) { return 0; } long binary = 0; long place = 1; while (decimal > 0) { long remainder = decimal % 2; binary += remainder * place; place *= 10; decimal = decimal / 2; } return binary; } public static void ha() { System.out.println("YES"); } public static void na() { System.out.println("NO"); } public static void line() { System.out.println(); } public static int mod = 1000000007; public static long pow(long x, long p) { x %= mod; long ans = 1; while (p > 0) { if (p % 2 == 1) ans = ans * x % mod; x = x * x % mod; p /= 2; } return ans; } public static void main(String args[]) { FastReader sc = new FastReader(); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- != 0) { int n = sc.nextInt(); int[] a = new int[n]; for(int i=0;i<n;i++) { a[i] = sc.nextInt(); } int count = 0; for(int i=0;i<n-1;i++) { if(a[i] > a[i+1]) { count++; } } System.out.println(count); } out.flush(); } }
2031A
wrong_submission
293,548,172
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class Solution { public static void solve(int N, int[] h) { int count = 0; for(int i=1;i<h.length;i++){ if(h[i] < h[i-1]) count++; } System.out.println(count); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int N = sc.nextInt(); int[] h = new int[N]; for(int i=0;i<N;i++){ h[i] = sc.nextInt(); } solve(N, h); } } }
2031A
wrong_submission
291,599,053
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; #define ll long long const ll MOD = 1e9 + 7; ll min(ll a, ll b) { return a < b ? a : b; } ll max(ll a, ll b) { return a > b ? a : b; } void solve() { ll n ; cin >> n; vector<ll> arr(n); for (auto& i :arr) cin >> i; ll right = 0; for (ll i = (n -2) ; i >= 0 ; i--) { if (arr[i] > arr[i+1]) { right++; } } ll left = 0; for (ll i = 1; i< n ; i++) { if (arr[i] < arr[i-1]) { left++; } } cout << min(left , right) << '\n'; return; } int main() { cin.tie(0)->sync_with_stdio(0); int t; cin >> t; while(t--) { solve(); } }
2031A
wrong_submission
291,614,904
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include "bits/stdc++.h" #define int long long #define str string using ld = long double; using namespace std; void solve() { int n, kol1 = 0, kol2 = 0; cin >> n; vector<int> a(n); for(int i = 0; i<n; ++i) cin >> a[i]; for(int i = n-1; i>=0; --i){ if(a[i]!=a[n-1]) break; else kol1+=1; } for(int i = 0; i<n; ++i){ if(a[i]!=a[0]) break; else kol2+=1; } cout << min(n-kol1,n-kol2) << endl; } signed main() { int t; cin >> t; while (t--) solve(); return 0; }
2031A
wrong_submission
291,578,779
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define se second #define fi first using namespace std; using pii=pair<int,int>; using ll=long long; const int N=1e6+3; int n,m,K; int a[N],b[N]; string s,t; void solve(){ int u,v,w,x,y,z; cin>>n;int ans=0; for(int i=1;i<=n;++i)cin>>a[i]; for(int i=2;i<=n;++i){ if(a[i]<a[i-1]){ ++ans;a[i]=a[i-1]; } } printf("%d\n",ans); } int main(){ ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); int T;for(cin>>T;T--;)solve(); return 0; }
2031A
wrong_submission
291,706,161
Java 21
WRONG_ANSWER on test 2
//package codeforcesques; import java.util.*; import java.io.*; public class q1div2987 { public static void main(String[] args) { FastReader fs=new FastReader(); int t=fs.nextInt(); while(t-->0) { int n=fs.nextInt(); int []arr=fs.readIntArray(n); HashSet<Integer> hs=new HashSet<>(); for(int i=0;i< arr.length;i++) hs.add(arr[i]); System.out.println(hs.size()-1); } } } class FastReader { BufferedReader gt; StringTokenizer st; public FastReader() { gt = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(gt.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } String nextLine() { String str = ""; try { str = gt.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } int nextInt() { return Integer.parseInt(next()); } int[] readIntArray(int n) { int[] res = new int[n]; for (int i = 0; i < n; i++) res[i] = nextInt(); return res; } long nextLong() { return Long.parseLong(next()); } long[] readLongArray(int n) { long[] res = new long[n]; for (int i = 0; i < n; i++) res[i] = nextLong(); return res; } String[] readStringArray(int n) { String[] str = new String[n]; for (int i = 0; i < n; i++) str[i] = nextLine(); return str; } }
2031A
wrong_submission
300,458,878
Java 21
WRONG_ANSWER on test 2
import java.io.*; import java.util.*; public class vlad_sum_sumofdigs { static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next() { while (!st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String line = ""; try { line = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return line; } } // Fill array function public static void fillIntArray(int[] arr, int len, FastScanner sc) { for (int i = 0; i < len; i++) { arr[i] = sc.nextInt(); } } // Helper code public static void helper(int[] arr, int len) { int cnt=0; for(int i=0;i<len-1;i++){ if(arr[i]>arr[i+1]){ cnt++; } } System.out.println(cnt); } // Main function public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { // Example: Implement main logic for each test case here int len = sc.nextInt(); int[] arr = new int[len]; fillIntArray(arr, len, sc); helper(arr,len); } out.close(); } }
2031A
wrong_submission