답안 #683872

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
683872 2023-01-19T14:09:54 Z victor_gao Furniture (JOI20_furniture) C++17
0 / 100
5 ms 904 KB
//#pragma GCC optimize("Ofast,unroll-loops,O3")
//#pragma GCC optimize("avx,avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,fma,tune=native")
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//#pragma pack(1)
#define fast ios::sync_with_stdio(0); cin.tie(0);
#define pii pair<int,int>
#define x first
#define y second
#define N 1005
using namespace std;
//using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//typedef tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> order_multiset;
//typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> order_set;
set<int>st[N];
int n,m,arr[N][N];
signed main(){
    fast
    cin>>n>>m;
    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++){
            cin>>arr[i][j];
            if (arr[i][j])
                st[i].insert(j);
        }
        st[i].insert(m+1);
    }
    int q; cin>>q;
    while (q--){
        int x,y; cin>>x>>y;
        st[x].insert(y);
        int now=*st[1].begin();
        for (int i=2;i<=n;i++)
            now=*(st[i].upper_bound(now-2));
        if (now<=m){
            cout<<0<<'\n';
            st[x].erase(y);
        }
        else cout<<1<<'\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
2 Incorrect 5 ms 904 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 724 KB Output is correct
2 Incorrect 5 ms 904 KB Output isn't correct
3 Halted 0 ms 0 KB -