Submission #1152147

#TimeUsernameProblemLanguageResultExecution timeMemory
1152147AgentPenginCollecting Stamps 3 (JOI20_ho_t3)C++20
0 / 100
0 ms324 KiB
/**
 *    author:  AgentPengin ( Độc cô cầu bại )
 *    created: 23.12.2022 10:08:02
 *    too lazy to update time
**/
#include<bits/stdc++.h>

#define EL '\n'
#define fi first
#define se second
#define NAME "TASK"
#define ll long long
#define lcm(a,b) (a/gcd(a,b))*b
#define db(val) "["#val" = " << (val) << "] "
#define bend(v) (v).begin(),(v).end()
#define sz(v) (int)(v).size()
#define ex exit(0)
#define int ll

using namespace std;

const ll mod = 1e9 + 7;
const int inf = 0x1FFFFFFF;
const int MAXN = 1e5 + 5;

int n,L,x[MAXN],t[MAXN];

signed main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    if (ifstream(NAME".inp")) {
        freopen(NAME".inp","r",stdin);
        freopen(NAME".out","w",stdout);
    }
    cin >> n >> L;
    for (int i = 1;i <= n;i++) cin >> x[i];
    for (int i = 1;i <= n;i++) cin >> t[i];
    // 
    int ans = 0;
    for (int i = n;i >= 1;i--) {
    	int tmp = 0;
    	for (int j = n;j >= i;j--) {
    		if (t[j] >= (L - x[j])) tmp++;
    	}
    	int bonus_time = (L - x[i]) * 2;
    	for (int j = 1;j < i;j++) {
    		if (t[j] >= (bonus_time + x[j])) tmp++;
    	}
    	ans = max(ans, tmp);
    }
    int tmp = 0;
    for (int i = 1;i <= n;i++) {
    	if (t[i] >= x[i]) tmp++;
    }
    ans = max(ans, tmp);
    cout << ans;
    
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}
// agent pengin wants to take apio (with anya-san)

Compilation message (stderr)

ho_t3.cpp: In function 'int main()':
ho_t3.cpp:31:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         freopen(NAME".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
ho_t3.cpp:32:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         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...