Submission #683888

# Submission time Handle Problem Language Result Execution time Memory
683888 2023-01-19T14:41:26 Z victor_gao Furniture (JOI20_furniture) C++17
5 / 100
2513 ms 848 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 int long long
#define pii pair<int,int>
#define x first
#define y second
#define N 105
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;
int dp[N][N],n,m;
int 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];
    }
    int q; cin>>q;
    while (q--){
        int x,y; cin>>x>>y;
        arr[x][y]=1;
        dp[1][1]=1;
        for (int i=1;i<=n;i++){
            for (int j=1;j<=m;j++){
                if (!arr[i][j])
                    dp[i][j]=(dp[i-1][j]|dp[i][j-1]);
                else dp[i][j]=0;
                dp[1][1]=1;
            }
        }
        if (dp[n][m])
            cout<<1<<'\n';
        else {
            cout<<0<<'\n';
            arr[x][y]=0;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 36 ms 468 KB Output is correct
3 Correct 80 ms 528 KB Output is correct
4 Correct 188 ms 544 KB Output is correct
5 Correct 208 ms 676 KB Output is correct
6 Correct 253 ms 580 KB Output is correct
7 Correct 178 ms 572 KB Output is correct
8 Correct 188 ms 688 KB Output is correct
9 Correct 143 ms 584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 36 ms 468 KB Output is correct
3 Correct 80 ms 528 KB Output is correct
4 Correct 188 ms 544 KB Output is correct
5 Correct 208 ms 676 KB Output is correct
6 Correct 253 ms 580 KB Output is correct
7 Correct 178 ms 572 KB Output is correct
8 Correct 188 ms 688 KB Output is correct
9 Correct 143 ms 584 KB Output is correct
10 Incorrect 2513 ms 848 KB Output isn't correct
11 Halted 0 ms 0 KB -