QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#747123 | #5484. Ghost Leg | t-aswath | WA | 0ms | 3528kb | C++14 | 1.6kb | 2024-11-14 16:23:45 | 2024-11-14 16:23:45 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define deb(x...) 42
#endif
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define MOD 1000000007
void solve() {
ll n,m;
cin>>n>>m;
vector<vector<int>>grid(m+2,vector<int>(n+2,-1));
for(int i=0;i<n;i++){
int x;
cin>>x;
grid[i+1][x]=1;
grid[i+1][x+1]=0;
}
map<int,int>ans;
for(int i=1;i<=n;i++){
ll curl=0;
ll curr=i;
while(curl<m){
curl++;
if(grid[curl][curr]==-1){
}
else if(grid[curl][curr]==1){
curr++;
}
else{
curr--;
}
}
ans[curr]=i;
}
for(auto x:ans){
cout<<x.S<<"\n";
}
}
int main() {
fast_io;
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("output.txt", "w", stderr);
#endif
ll t = 1;
// cin >> t;
for(ll i = 0; i < t; i++) {
#ifdef LOCAL
cout << "CASE " << i + 1 << ":\n";
#endif
solve();
}
#ifdef LOCAL
cout << endl << "Finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec\n\n";
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3528kb
input:
4 5 1 2 1 3 2
output:
3 2 4 1
result:
wrong answer 2nd lines differ - expected: '4', found: '2'