130972025-01-06 14:30:25ercseferencZenehallgatáscpp17Wrong answer 0/501ms568 KiB
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
long long mar(long long k, long long mod){
    if(k%mod==0)return mod;
    else return k%mod;}
struct idopont{long long ido; int ind;};
bool hasonl(idopont n, idopont m){
    return n.ido<m.ido;}
int main()
{
    int m,n,x; ifstream f("szamok.txt"); f>>n>>m;
    int a[n];
    long long mod=0; for(int i=0; i<n; i++)
        {f>>x; mod+=x; a[i]=mod;}
    vector<idopont>pont(m); long long k;
    for(int i=0; i<m; i++)
        {f>>k; pont[i].ido=mar(k,mod); pont[i].ind=i;}
    sort(pont.begin(),pont.end(),hasonl);
    int megol[m]; int j=0; bool megvan;
    for(int i=0; i<m; i++){
        megvan=0;
        while(!megvan){
            if(pont[i].ido<=a[j]){megol[pont[i].ind]=j+1; megvan=1;}
            else j++;}}
    for(int i=0; i<m; i++){cout<<megol[i]<<" ";}
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/01ms508 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms316 KiB
9Wrong answer0/21ms316 KiB
10Wrong answer0/21ms316 KiB
11Wrong answer0/21ms316 KiB
12Wrong answer0/21ms316 KiB
13Wrong answer0/21ms316 KiB
14Wrong answer0/21ms500 KiB
15Wrong answer0/21ms568 KiB
16Wrong answer0/21ms508 KiB
17Wrong answer0/21ms508 KiB
18Wrong answer0/21ms316 KiB
19Wrong answer0/21ms508 KiB
20Wrong answer0/21ms316 KiB
21Wrong answer0/21ms316 KiB
22Wrong answer0/31ms316 KiB
23Wrong answer0/31ms316 KiB
24Wrong answer0/31ms316 KiB