Submission #883435

# Submission time Handle Problem Language Result Execution time Memory
883435 2023-12-05T09:23:49 Z stelle Ruka (COI15_ruka) C++14
9 / 100
6 ms 4700 KB
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int x[N],y[N];
int n,q;
int tinh(){
    int x1=1, y1=1, d=0;
    for (int i=1; i<=n; i++){
        int x2=x1+x[i];
        int y2=y1+y[i];
        if (x2*x1<=0 && x2!=0) d++;
        if (y2*y1<=0 && y2!=0) d++;
        x1=x2;
        y1=y2;
    }
    return d;
}
void sub1()
{
    int i=1;
    while(q--)
    {
        char a;
        cin>>a;
        if(a=='B')
        {
            if(i==1)continue;
            i--;
        }
        if(a=='F')
        {
            if(i!=n)
            {
                i++;
            }
        }
        if(a=='Q')
        {
            cout<<tinh()<<'\n';
        }
        if(a=='C')
        {
            int nx,ny;
            cin>>nx>>ny;
            x[i]=nx;
            y[i]=ny;
        }
    }
}
int main ()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("simulation.inp","r",stdin);
//    freopen("simulation.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>x[i]>>y[i];
    cin>>q;
    if(n<=1000)
    {
        sub1();
        return 0;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Incorrect 6 ms 4700 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Incorrect 6 ms 4700 KB Output isn't correct
6 Halted 0 ms 0 KB -