Submission #923716

# Submission time Handle Problem Language Result Execution time Memory
923716 2024-02-07T15:37:29 Z pcc I want to be the very best too! (NOI17_pokemonmaster) C++14
35 / 100
262 ms 20696 KB
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int mxn = 1e5+10;
int R,C,Q;
vector<vector<int>> arr,brr;
ordered_set st;
set<int> pos[mxn];

inline void add(int c,int p){
	st.erase(*pos[c].begin());
	pos[c].insert(p);
	st.insert(*pos[c].begin());
	return;
}
inline void del(int c,int p){
	st.erase(*pos[c].begin());
	pos[c].erase(p);
	st.insert(*pos[c].begin());
	return;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>R>>C>>Q;
	arr = vector<vector<int>>(R+1,vector<int>(C+1,0));
	brr = arr;
	for(int i = 1;i<=R;i++)for(int j = 1;j<=C;j++)cin>>arr[i][j];
	for(int i = 0;i<mxn;i++){
		pos[i].insert(i+mxn);
		st.insert(i+mxn);
	}
	for(int i = 1;i<=R;i++)for(int j = 1;j<=C;j++){
		cin>>brr[i][j];
		add(brr[i][j],j);
	}
	while(Q--){
		int t,x,y,v;
		cin>>t>>x>>y>>v;
		swap(x,y);
		if(t == 2){
			if(v>=y)cout<<st.order_of_key(v+1)<<'\n';
			else cout<<"0\n";
		}
		else{
			del(brr[x][y],y);
			brr[x][y] = v;
			add(brr[x][y],y);
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 119 ms 18064 KB Output is correct
2 Correct 123 ms 18316 KB Output is correct
3 Correct 119 ms 18064 KB Output is correct
4 Correct 115 ms 18080 KB Output is correct
5 Correct 121 ms 18104 KB Output is correct
6 Correct 122 ms 18148 KB Output is correct
7 Correct 117 ms 18060 KB Output is correct
8 Correct 121 ms 18132 KB Output is correct
9 Correct 115 ms 18060 KB Output is correct
10 Correct 112 ms 18452 KB Output is correct
11 Correct 125 ms 18064 KB Output is correct
12 Correct 121 ms 18188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 18316 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 166 ms 20696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 119 ms 18064 KB Output is correct
2 Correct 123 ms 18316 KB Output is correct
3 Correct 119 ms 18064 KB Output is correct
4 Correct 115 ms 18080 KB Output is correct
5 Correct 121 ms 18104 KB Output is correct
6 Correct 122 ms 18148 KB Output is correct
7 Correct 117 ms 18060 KB Output is correct
8 Correct 121 ms 18132 KB Output is correct
9 Correct 115 ms 18060 KB Output is correct
10 Correct 112 ms 18452 KB Output is correct
11 Correct 125 ms 18064 KB Output is correct
12 Correct 121 ms 18188 KB Output is correct
13 Correct 164 ms 19864 KB Output is correct
14 Correct 210 ms 19748 KB Output is correct
15 Correct 262 ms 19724 KB Output is correct
16 Correct 234 ms 19596 KB Output is correct
17 Correct 230 ms 19740 KB Output is correct
18 Correct 157 ms 20012 KB Output is correct
19 Correct 186 ms 19856 KB Output is correct
20 Correct 221 ms 20112 KB Output is correct
21 Correct 190 ms 19656 KB Output is correct
22 Correct 212 ms 19968 KB Output is correct
23 Correct 210 ms 20112 KB Output is correct
24 Correct 225 ms 19852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 119 ms 18064 KB Output is correct
2 Correct 123 ms 18316 KB Output is correct
3 Correct 119 ms 18064 KB Output is correct
4 Correct 115 ms 18080 KB Output is correct
5 Correct 121 ms 18104 KB Output is correct
6 Correct 122 ms 18148 KB Output is correct
7 Correct 117 ms 18060 KB Output is correct
8 Correct 121 ms 18132 KB Output is correct
9 Correct 115 ms 18060 KB Output is correct
10 Correct 112 ms 18452 KB Output is correct
11 Correct 125 ms 18064 KB Output is correct
12 Correct 121 ms 18188 KB Output is correct
13 Incorrect 113 ms 18316 KB Output isn't correct
14 Halted 0 ms 0 KB -