Submission #1125629

#TimeUsernameProblemLanguageResultExecution timeMemory
1125629cpptowinBring Down the Grading Server (CEOI23_gradingserver)C++20
0 / 100
4094 ms324 KiB
#include<bits/stdc++.h>
#define fo(i,d,c) for(int i=d;i<=c;i++)
#define fod(i,c,d) for(int i=c;i>=d;i--)
#define maxn 1000010
#define N 1010
#define fi first
#define se second
#define pb emplace_back
#define en cout<<"\n";
#define int long long
#define inf (int)1e18
#define pii pair<int,int>
#define vii vector<pii>
#define lb(x) x&-x
#define bit(i,j) ((i>>j)&1LL)
#define offbit(i,j) (i^(1LL<<j))
#define onbit(i,j) (i|(1LL<<j))
#define vi vector<int>
#define all(x) x.begin(),x.end()
#define ss(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
template <typename T1, typename T2> bool minimize(T1 &a, T2 b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
using namespace std;
const int mod = 1e9 + 7;
const int nsqrt = 450;
int x,y,z,t,s;
void solve()
{
    cin >> x >> y >> z >> t;
    bool ok = 0;
    while(1)
    {
        if(x < 0 or z < 0) break;
        if(!ok)
        {
            if(x > t * s) z -= (x - t * s);
            else if(x >= s and t) t--;
        }
        else
        {
            if(z > y * s) x -= (z - y * s);
            else if(z >= s and y) y--;
        }
//        cout << x << ' ' << y << ' ' << z << ' ' << t;en;
        ok ^= 1;
    }
    if(x > 0) cout << "YES";
    else cout << "NO";
    en;
}
main()
{
#define name "TASK"
    if(fopen(name".inp","r"))
    {
        freopen(name".inp","r",stdin);
        freopen(name".out","w",stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T;
    cin >> s >> T;
    while(T--) solve();
}

Compilation message (stderr)

gradingserver.cpp:69:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   69 | main()
      | ^~~~
gradingserver.cpp: In function 'int main()':
gradingserver.cpp:74:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |         freopen(name".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
gradingserver.cpp:75:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |         freopen(name".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...